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
๐ŸŒ
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, ...
๐ŸŒ
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 types, ... ... 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
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
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
Why is a double preferred over a float?
Dealing with any type of floating point numbers is a science as they are not exact. Essentially it boils down to doubles being accurate to a greater number of decimal places and if you are using a JVM memory is not likely to be a problem. If you are doing finance type tasks there are specific classes that should be used - the same as if the data is to be stored in a database - which will guarantee accuracy of your decimal places (up to a specified point) More on reddit.com
๐ŸŒ r/java
12
1
October 24, 2011
[New CS Student]Trouble differentiating between floats and doubles--why is 23.5 considered a double?
Every decimal number literal will be considered a double by default unless specified as float with the f. Same goes for whole numbers being integers by default. More on reddit.com
๐ŸŒ r/learnjava
7
5
August 7, 2021
People also ask

When should I prefer float over double in Java?
In Java programming, the choice between "float" and "double" is decided by the unique project requirements. A person must choose "float" when memory saving becomes essential, and a slightly lower level of accuracy is acceptable. The "float" data type, which is a 32-bit single-precision structure, uses half the amount of memory of its opposition, "double" (which is a 64-bit double-precision). The lower memory usage and suitable accuracy of floats make them excellent for applications like real-time graphics processing. In situations where high accuracy above seven decimal places is not required,
๐ŸŒ
simplilearn.com
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
How does Java handle precision issues with float and double?
The programming language Java, like many computer languages, uses the IEEE 754 standard for expressing floating-point numbers. While this standard improves consistency between platforms, it does not completely eliminate accuracy concerns. Rounding errors can happen for both float and double due to the natural restrictions of expressing decimal integers in binary. Developers should be aware of possible accuracy challenges and carefully select the proper data type for their application's needs. When accurate decimal representation is required, double is the safer option.
๐ŸŒ
simplilearn.com
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
How do float and double behave in Java's latest version?
As of the most recent Java version, the basic behavior of float and double is similar to earlier versions. The IEEE 754 standard, which has long been used in the industry for floating-point arithmetic, determines the key differences, such as the use of memory and accuracy. While Java developments can result in improvements, the fundamental concepts of how to double and float behave in terms of accuracy, memory consumption, and range are unlikely to change much. Developers should stay aware of any revisions, but this may generally depend on the known behavior of double vs float in Java's most r
๐ŸŒ
simplilearn.com
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
๐ŸŒ
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?

๐ŸŒ
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....
๐ŸŒ
Study.com
study.com โ€บ business courses โ€บ java programming tutorial & training
Java: Float vs. Double - Lesson | Study.com
July 21, 2018 - To unlock this lesson you must ... of float, which holds 4 bytes of memory (32 bits) and stores about 7 digits, and double, which can hold 8 bytes (64 bits) and store about 15 digits after the decimal point, data types ...
Find elsewhere
๐ŸŒ
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.
๐ŸŒ
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
Java has five types of literals i.e., integer literals, boolean literals, Character literals, String literals, and floating-point literals. float and double are called floating-point literals. 1. Memory : float takes 4 bytes (32 bits) where as double takes 8 bytes(64 bits).
๐ŸŒ
FavTutor
favtutor.com โ€บ blogs โ€บ java-float-vs-double
Java: Float vs Double | 4 Main Differences (& when to use?) | FavTutor
February 23, 2021 - Both data types are primitive by nature: meaning that their definitions are included as part of the language itself (or more specifically, the java.lang package โ€“ the default import for any Java program). Why exactly are two data types allocated for doing the same job? Well, they vary a lot in their scope and usability in various scenarios. Letโ€™s have a look at how different these two data types are. So, here are 4 main differences between float and double in Java:
๐ŸŒ
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!
๐ŸŒ
Educative
educative.io โ€บ blog โ€บ float-vs-double-in-java
Float vs. double in Java
In Java, float is a 32-bit single-precision floating-point type and double is a 64-bit double-precision floating-point type, with double being the default for decimal literals. The choice between them depends on your application's precision requirements, memory constraints, and performance needs.
๐ŸŒ
Blogger
javarevisited.blogspot.com โ€บ 2016 โ€บ 05 โ€บ difference-between-float-and-double-in-java.html
Difference between float and double variable in Java? Example
July 26, 2023 - Though both float and double datatype are used to represent floating-point numbers in Java, a double data type is more precise than float. A double variable can provide precision up to 15 to 16 decimal points as compared to float precision of ...
๐ŸŒ
Upgrad
upgrad.com โ€บ home โ€บ blog โ€บ software development โ€บ difference between float and double in java: float vs double in java, similarities, and more
Float vs Double in Java: Key Differences & Similarities
July 7, 2026 - To fully grasp the difference between float and double in java, itโ€™s essential to see how they behave in actual code. The key differences lie in precision, memory consumption, and how they handle rounding during arithmetic operations.
๐ŸŒ
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.
๐ŸŒ
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
๐ŸŒ
Instanceofjava
instanceofjava.com โ€บ 2016 โ€บ 08 โ€บ difference-between-float-and-double-java.html
Difference between float and double java - InstanceOfJava
Float data type in java is represented in 32 bits, with 1 sign bit, 8 bits of exponent, and 23 bits of the mantissa ยท Where as Double is is represented in 64 bits, with 1 sign bit, 11 bits of exponent, and 52 bits of mantissa.
๐ŸŒ
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 ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ comparison-of-double-and-float-primitive-types-in-java
Comparison of double and float primitive types in Java - GeeksforGeeks
March 6, 2023 - // But this program prints false. class Geeksforgeeks { public static void main(String args[]) { float f = 5.1f; double d = 5.1; System.out.println(f == d); } }
๐ŸŒ
Great Assignment Help
us.greatassignmenthelp.com โ€บ home โ€บ get to know the significant differences between float vs. double
Get To Know The Significant Differences Between Float Vs. Double
September 27, 2025 - When you want to express a float data type in Java, it is essential to add the letter f at the end of the data type; otherwise, it will store the data as a double. Double: The double data type saves decimal numbers with an accuracy of 15โ€“16 digits. Its default value is 0.0d, which indicates that if you do not add f or d to the concluding part of the decimal, Java will store the number as a double. Also read: Get to Know the Difference between Java and JavaScript
๐ŸŒ
DEV Community
dev.to โ€บ ricardocaselati โ€บ understanding-float-and-double-in-java-hoa
Understanding float and double in Java - DEV Community
December 7, 2024 - public class FloatExample { public static void main(String[] args) { float numA = -101.23f; float numB = 2.356f; System.out.println(numA + numB); // Output: -98.874 } } public class DoubleExample { public static void main(String[] args) { double valueOne = 0.5; // Implicitly a double double valueTwo = 0.5d; // Explicitly a double double valueThree = 0.123456789; // High precision System.out.println(valueOne); // Output: 0.5 System.out.println(valueTwo); // Output: 0.5 System.out.println(valueThree); // Output: 0.123456789 } }