Doubles take up twice the amount of memory as floats do (hence the name) but as a result they are more precise and can represent a wider range of values. Memory space doesn’t matter as much as it used to so for most use cases, doubles are just fine. In certain applications though where speed and performance is a higher priority than accuracy, such as graphics calculations for video games, using floats instead of doubles may be preferable. Answer from Quantum-Bot on reddit.com
🌐
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 - Java provides two primitive data types for floating-point arithmetic: float and double. Both adhere to the IEEE 754 standard, ensuring consistent behavior across platforms. However, their size, precision, and performance differ significantly.
Discussions

floating point - Float and double datatype in Java - Stack Overflow
You should use floats instead of double when memory usage is critical. If you need more precise computations, use doubles. ... @Everv0id: I'm not sure of any situation in which memory was so tight that one had to sacrifice accuracy for space. (You're using Java, for goodness' sake...) More on stackoverflow.com
🌐 stackoverflow.com
When should I use double and when should I use float for Java?
On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: Limiting your involvement with Reddit, or Temporarily refraining from using Reddit Cancelling your subscription of Reddit Premium as a way to voice your protest. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/learnprogramming
65
59
January 6, 2024
Double vs BigDecimal in financial programming

Use long or big decimal. Performance problems will most probably arise elsewhere before you factor a big decimal as the culprit

More on reddit.com
🌐 r/java
105
44
May 22, 2018
Float or double?

A pair of doubles for location on Earth to sub-metre accuracy? A pair of 32-bit integers will let you store it to the nearest centimetre.

Sometimes you need to ask if a floating point is even right for your use case.

More on reddit.com
🌐 r/programming
387
952
June 5, 2017
🌐
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?
The key difference between a float and double in Java is that a double can represent much larger numbers than a float. Both data types represent numbers with decimals, but a float is 32 bits in size while a double is 64 bits.
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › difference-between-float-and-double
Difference between Float and Double - GeeksforGeeks
July 23, 2025 - The key difference is their precision and storage size. A float is typically a 32-bit number with a precision of about 7 decimal digits, while a double is a 64-bit number with a precision of about 15 decimal digits.
🌐
Codefinity
codefinity.com › blog › Float-vs-Double
Float vs Double
Both are used to represent floating ... storage requirements. The float type, typically a single-precision 32-bit IEEE 754 floating point, is used for decimal values that do not require extreme precision....
Find elsewhere
🌐
Medium
medium.com › @qingedaig › java-bigdecimal-vs-double-vs-float-012c7149e550
Java BigDecimal vs double vs float | by Alice Dai | Medium
October 15, 2024 - Memory: Use float when memory is a concern and lower precision is acceptable. Choosing the right data type depends on your specific needs regarding precision, performance, and the nature of the calculations you are performing. For most financial applications, BigDecimal is recommended, while double is commonly used for scientific computations.
🌐
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 - As the Double data type consumes more memory in comparison to the Float data type, but it gives more accurate values of up to 15 digits of precision than the float data type. By default, Java considers any decimal or float values of double type, so we do not need to typecast any decimal value ...
🌐
Study.com
study.com › business courses › java programming tutorial & training
Java: Floating Point Numbers - Lesson | Study.com
October 3, 2018 - The double data type stores decimal values with 15-16 digits of precision. Remember that the default value is 0.0d, so this means that if you don't append f or d to the end of the decimal, the value will be stored as a double in Java.
🌐
FavTutor
favtutor.com › blogs › java-float-vs-double
Java: Float vs Double | 4 Main Differences (& when to use?) | FavTutor
February 23, 2021 - Float allocates 23 bits for mantissa, while double allocates 52 bits for mantissa. Similarly, float uses 7 bits for exponent while double allocate 11 bits for exponent. Precision: Float can allow only 7 bits of precision.
🌐
DZone
dzone.com › coding › java › understanding floating-point precision issues in java
Understand Floating-Point Precision Issues in Java
September 12, 2024 - More precisely, instead of 0.1, we get 0.100000001490116119384765625. How can we verify this? There are a couple of ways. Take a look at the following code: ... Now that we know the value we see at initialization is different from what is actually stored in float/double, we expect the value on the left (0.1) but instead, we initialize with the value on the right (0.100000001490116119384765625):
🌐
Coderanch
coderanch.com › t › 663428 › java › float-double-Java
float vs double in Java (Beginning Java forum at Coderanch)
March 16, 2016 - The fractional part is ¾ which can be exactly expressed in binary (0.1100) (but it is represented differently inside a double). [edit]Don't use floating‑point arithmetic if you require precision. Don't use floats at all (unless some part of the API requires them). ... Rupjit Chakraborty wrote:I am confused by the behaviour of float and double in Java.
🌐
Blogger
javahungry.blogspot.com › 2019 › 11 › difference-between-float-and-double-in-java.html
7 Difference Between float and double Datatypes in Java | Java Hungry
double precision upto 15-16 digits after decimal : 1.2345678910111213 4. Data loss : There will be no data loss when the float is converted to double as float has a lower range than double. Data loss is expected when double is converted to float. 5. Default datatype : float is not the default data type value of floating point literals. double is the default data type of floating point literals. 6. Wrapper class : Wrapper class for float is java.lang.Float.
🌐
GeeksforGeeks
geeksforgeeks.org › c++ › difference-float-double-c-cpp
Difference between float and double in C/C++ - GeeksforGeeks
June 23, 2023 - float has 7 decimal digits of precision. double is a 64-bit IEEE 754 double precision Floating Point Number - 1 bit for the sign, 11 bits for the exponent, and 52* bits for the value.
🌐
JanBask Training
janbasktraining.com › community › java › when-to-use-float-vs-double-java
When to use float vs double Java? | JanBask Training Community
October 6, 2022 - I also read When do you use float and when do you use double, but if float is really only good for numbers with a lot of digits after the decimal point, then why can't we just use one of the many variations of double? Is there any reason as to why people insist on using floats even though it doesn't really have any advantages anymore? Is it just too much work to change it all? ... LibGDX is a framework mostly used for game development. In game development you usually have to do a whole lot of number crunching in real-time and any performance you can get matters. That's why game developers usually use float whenever float precision is good enough.
🌐
Upgrad
upgrad.com › home › blog › software development › float vs double in java: key differences you should know
Float vs Double in Java: Key Differences Explained
February 3, 2025 - The float data type can hold up to 7 decimal digits of precision, which makes it ideal for scenarios where memory efficiency is a priority over high precision. As a 32-bit type, it uses less memory compared to double, which is a 64-bit type.
🌐
Quora
quora.com › What-is-the-difference-between-float-and-double-in-C-C-Java
What is the difference between float and double in C/C++/Java? - Quora
Answer: The word double in this context refers to double-precision floating-point. The word float in this context refers to single-precision floating point. So, the primary difference between the two types is precision. Using double, you have more digits of precision than you have with float. I...
🌐
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!