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 - 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.
🌐
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?
When Java encounters a decimal in a program, or a calculation generates a floating point number, Java treats the number as a double. For example, both of the following lines of code fail to compile because Java assumes that any decimal is a double.
Published: May 23, 2026
Discussions

floating point - Float and double datatype in Java - Stack Overflow
For example, calculations such as square root, or transcendentals such as sine and cosine, result in a value whose precision requires a floating-point type. Java implements the standard (IEEE–754) set of floatingpoint types and operators. There are two kinds of floating-point types, float and double... More on stackoverflow.com
🌐 stackoverflow.com
java - different values for float and double - Stack Overflow
I don't understand why are float values different from double values. From the example bellow it appears that float provides different result than double for the same operation: public class Test ... 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
float vs. double – What's the Key Difference?"
The difference is memory size. Floats in Java (which I assume is the language you’re talking about) take up 32 bits of memory, the same as an integer. Doubles, as you might guess from the name, take up double the space: 64 bits. 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 - 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.
🌐
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 - Both the float and double in Java represent or store real numbers in them, that is the numbers with fractions or decimal points. For example :1.23, 3.14, 1.1111.
🌐
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 - By the way, the double type also has a larger range than float and if your numbers don't fit well in float then you have to use double in Java. It's also worth noting that floating-point numbers or real numbers are by default double in Java. If you want to store them into the float variable, you need to either cast them or use the prefix 'f' or 'F' as shown in our example.
🌐
Study.com
study.com › business courses › java programming tutorial & training
Java: Float vs. Double - Lesson | Study.com
July 21, 2018 - This lesson has provided an overview 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 in Java.
Find elsewhere
🌐
Javatpoint
javatpoint.com › float-vs-double-java
Float Vs Double Java - Javatpoint
Java Program to swap two string variables without using third or temp variable.
🌐
Educative
educative.io › blog › float-vs-double-in-java
Float vs. double in Java
For example: float value = 3.14; // Compilation error: possible lossy conversion from double to float float value2 = 3.14f; // Valid · Similarly, when converting from double to float you need an explicit cast: ... Understanding this behavior is part of comparing float vs. double in Java: double ...
🌐
Java Code Geeks
javacodegeeks.com › home › core java
Float vs. Double in Java - Java Code Geeks
February 4, 2025 - In Java, both float and double data types are used to store floating-point numbers. However, they have differences in precision, storage, and performance, which makes them suitable for different use cases.
🌐
Unstop
unstop.com › home › blog › 10+ difference between float and double explained (+examples)
10+ Difference Between Float And Double Explained (+Examples)
December 3, 2024 - Float Vs. Double| Default Type in Operations: In languages like Java, double is the default for floating-point literals unless specified otherwise (e.g., 3.14 is treated as a double, while 3.14f is treated as a float).
🌐
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); } } ... The output is true in the first example and false in second.
🌐
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 } }
🌐
FavTutor
favtutor.com › blogs › java-float-vs-double
Java: Float vs Double | 4 Main Differences (& when to use?) | FavTutor
February 23, 2021 - This loss of bits from the end of the number is very pronounced while using float. The number of bits lost is much lesser while using double because of the large number of bits allocated for the exponent. Default: Double is the default data type used by Java for dealing with fractional numbers.
🌐
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.
🌐
Codefinity
codefinity.com › blog › Float-vs-Double
Float vs Double
This article explores the nuanced differences between the float and double data types in programming, highlighting their importance for precision and performance across various applications. It delves into their distinct characteristics, such as precision, memory usage, and when each should be utilized based on specific programming needs.