The Wikipedia page on it is a good place to start.

To sum up:

  • float is represented in 32 bits, with 1 sign bit, 8 bits of exponent, and 23 bits of the significand (or what follows from a scientific-notation number: 2.33728*1012; 33728 is the significand).

  • double is represented in 64 bits, with 1 sign bit, 11 bits of exponent, and 52 bits of significand.

By default, Java uses double to represent its floating-point numerals (so a literal 3.14 is typed double). It's also the data type that will give you a much larger number range, so I would strongly encourage its use over float.

There may be certain libraries that actually force your usage of float, but in general - unless you can guarantee that your result will be small enough to fit in float's prescribed range, then it's best to opt with double.

If you require accuracy - for instance, you can't have a decimal value that is inaccurate (like 1/10 + 2/10), or you're doing anything with currency (for example, representing $10.33 in the system), then use a BigDecimal, which can support an arbitrary amount of precision and handle situations like that elegantly.

Answer from Makoto on Stack Overflow
🌐
Reddit
reddit.com › r/learnprogramming › when should i use double and when should i use float for java?
r/learnprogramming on Reddit: When should I use double and when should I use float for Java?
January 6, 2024 -

I am learning Java, and am confuse on when to choose double or float for my real numbers or int. It feels like, it doesn’t matter because from my limited experience (with Java) both of them deliver the same results, but I don’t want to go further down the learning curve with Java and have a bad habit of using either messing up my code, and not having a clue as to why. So, when should you use float and double?

🌐
Baeldung
baeldung.com › home › java › java numbers › float vs. double in java
Float vs. Double in Java | Baeldung
January 4, 2025 - This test confirms that float uses 4 bytes, while double uses 8 bytes, highlighting the difference in memory requirements between these two data types. Precision defines the number of significant digits a data type can represent accurately, ...
Discussions

floating point - Float and double datatype in Java - Stack Overflow
The float data type is a single-precision 32-bit IEEE 754 floating point and the double data type is a double-precision 64-bit IEEE 754 floating point. What does it mean? And when should I use float More on stackoverflow.com
🌐 stackoverflow.com
What's the difference between float , double and long variables?
I know an integer can hold a whole number, a float can hold a decimal number and an unsigned can hold only positive numbers. But what is the function of double and long More on sololearn.com
🌐 sololearn.com
1
0
November 5, 2019
c++ - When do you use float and when do you use double - Software Engineering Stack Exchange
Frequently, in my programming experience, I need to make a decision whether I should use float or double for my real numbers. Sometimes I go for float, sometimes I go for double, but really this fe... More on softwareengineering.stackexchange.com
🌐 softwareengineering.stackexchange.com
February 28, 2013
float vs. double – What's the Key Difference?"
This was starting to change even ... in Java were designed to make the transition easier for programmers who were used to using C, a popular language at the time. ... The general rule of thumb is to always default to doubles for the superior precision, and only consider floats when you're bottlenecked on some kind of numerical processing. There's usually not an appreciable performance difference between single operations ... More on reddit.com
🌐 r/learnprogramming
12
16
November 2, 2024
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › difference-between-float-and-double
Difference between Float and Double - GeeksforGeeks
July 23, 2025 - Float is a 32-bit type with single-precision, while double is a 64-bit type with double-precision. Float uses less memory but offers less precision, while double uses more memory but provides higher precision.
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Float-vs-Double-Whats-the-difference
Java double vs float: What's the difference?
... Compare Java's floating-point ... ... The key difference between a float and double in Java is that a double can represent much larger numbers than a float....
Published: May 23, 2026
🌐
Codefinity
codefinity.com › blog › Float-vs-Double
Float vs Double
Float consumes 32 bits of memory, while double consumes 64 bits. The choice between them can affect the application's memory usage, especially when dealing with large data arrays or matrices.
Find elsewhere
🌐
Scaler
scaler.com › home › topics › float vs double in java - difference you should know
Float Vs Double in Java - Difference You Should Know - Scaler Topics
March 27, 2024 - By default, Java considers any ... in the case of Double data type values. ... The main difference between Java Float and Double is their precision and range....
🌐
YouTube
youtube.com › selenium express
Confusing differences between float and double || Java || Datatypes - YouTube
This video covers float and double data types in java. java variable and data type's complete tutorial link : https://www.youtube.com/watch?v=rp6KTcW9Jlc Few
Published: September 15, 2017
Views: 24K
🌐
Java Code Geeks
javacodegeeks.com › home › core java
Float vs. Double in Java - Java Code Geeks
February 4, 2025 - In Java, handling floating-point numbers efficiently is crucial for numerical computations. Java provides two primary data types for representing decimal numbers: float and double. While both serve the same purpose, they differ in precision, storage size, and use cases.
🌐
Medium
medium.com › @ujjawalr › what-happens-when-you-compare-float-and-double-in-java-51f236a6d89c
What happens when you compare float and double in Java? | by Ujjawal Rohra | Medium
September 8, 2025 - double is a 64-bit IEEE-754 binary floating point (double precision). These types store numbers as sign × significand × 2^exponent and can only represent finitely many binary fractions.
Top answer
1 of 8
219

The default choice for a floating-point type should be double. This is also the type that you get with floating-point literals without a suffix or (in C) standard functions that operate on floating point numbers (e.g. exp, sin, etc.).

float should only be used if you need to operate on a lot of floating-point numbers (think in the order of thousands or more) and analysis of the algorithm has shown that the reduced range and accuracy don't pose a problem.

long double can be used if you need more range or accuracy than double, and if it provides this on your target platform.

In summary, float and long double should be reserved for use by the specialists, with double for "every-day" use.

2 of 8
48

There is rarely cause to use float instead of double in code targeting modern computers. The extra precision reduces (but does not eliminate) the chance of rounding errors or other imprecision causing problems.

The main reasons I can think of to use float are:

  1. You are storing large arrays of numbers and need to reduce your program's memory consumption.
  2. You are targeting a system that doesn't natively support double-precision floating point. Until recently, many graphics cards only supported single precision floating points. I'm sure there are plenty of low-power and embedded processors that have limited floating point support too.
  3. You are targeting hardware where single-precision is faster than double-precision, and your application makes heavy use of floating point arithmetic. On modern Intel CPUs I believe all floating point calculations are done in double precision, so you don't gain anything here.
  4. You are doing low-level optimization, for example using special CPU instructions that operate on multiple numbers at a time.

So, basically, double is the way to go unless you have hardware limitations or unless analysis has shown that storing double precision numbers is contributing significantly to memory usage.

🌐
YouTube
youtube.com › watch
Double, Long and Float Java Tutorial #9 - YouTube
$1,500 OFF ANY Springboard Tech Bootcamps with my code ALEXLEE1500. See if you qualify for the JOB GUARANTEE! 👉 https://bit.ly/3HX970hHere are the exact dif...
Published: January 10, 2019
🌐
Quora
quora.com › What-is-the-difference-between-using-double-for-floating-point-numbers-in-Java-as-opposed-to-using-float-or-long-in-C-C
What is the difference between using double for floating point numbers in Java as opposed to using float or long in C/C++? - Quora
Answer (1 of 2): Disclaimer: I am not a Java expert Question is sort of confusing. A long is an integral type, so I think we can ignore that part of the question. Computer languages provide some level of abstraction over the CPU. But that doesn’t mean they abandon the capabilities of the CPU an...
🌐
Quora
quora.com › Why-does-Java-have-two-types-of-floats-float-double-Why-not-just-have-one-type-of-float-like-C-C-has-only-one-type-of-ints-int
Why does Java have two types of floats (float & double)? Why not just have one type of float like C/C++ has only one type of ints (int)? - Quora
Answer (1 of 2): Wow, C/C++ has only one type of ints? Are you, like, sure about that? There are signed and unsigned versions, and each of them comes in a variety of helpful sizes (char, short int, “just plain” int, long int, and for decades now also long long int).
🌐
EDUCBA
educba.com › home › software development › software development tutorials › top differences tutorial › java float vs double
Java float vs Double | Top 7 Beneficial Comparisons To Learn
January 11, 2024 - Double and float data types represent floating-point numbers in Java; a double data type is more precise than a float. A double variable can provide precision up to 15 to 16 decimal points compared to float precision of 6 to 7 decimal digits.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Simplilearn
simplilearn.com › home › resources › software development › float vs double in java: key differences you should know
Float vs Double in Java: Key Differences You Should Know
November 17, 2025 - Explore the key differences between float and double in Java. Our comprehensive guide helps you choose the right type for your Java applications. Perfect for new coders!
🌐
Coderanch
coderanch.com › t › 663428 › java › float-double-Java
float vs double in Java (Beginning Java forum at Coderanch)
March 16, 2016 - Tim Holloway wrote:There is absolutely no way to tell. "Trustworthy" is a hardware issue. Erm, no it isn't. It might be an issue of the internal format, but that's almost certainly dictated by a standard (like IEEE-754). And Java floats and doubles will be the same on any machine.
🌐
Coderanch
coderanch.com › t › 663980 › java › Float-Double
Float vs. Double (Beginning Java forum at Coderanch)
I now understand that this is because: 1) the compiler determines the appropriate data type for the value (in this case - 102.0) 2) because the compiler determined that the value is double, it cannot evaluate it into a float variable unless an explicit cast is done or using the 'f' suffix on the value. 3) and that there is a data type progression based on the size of the data type.
🌐
Unstop
unstop.com › home › blog › 10+ difference between float and double explained (+examples)
10+ Difference Between Float And Double Explained (+Examples)
December 3, 2024 - A float provides single precision (6-7 decimal places) and uses 4 bytes of memory, while a double offers double precision (15-16 decimal places) and uses 8 bytes. Use float in applications where memory efficiency and speed are crucial, such ...