Huge difference.

As the name implies, a double has 2x the precision of float[1]. In general a double has 15 decimal digits of precision, while float has 7.

Here's how the number of digits are calculated:

double has 52 mantissa bits + 1 hidden bit: log(253)รทlog(10) = 15.95 digits

float has 23 mantissa bits + 1 hidden bit: log(224)รทlog(10) = 7.22 digits

This precision loss could lead to greater truncation errors being accumulated when repeated calculations are done, e.g.

float a = 1.f / 81;
float b = 0;
for (int i = 0; i < 729; ++ i)
    b += a;
printf("%.7g\n", b); // prints 9.000023

while

double a = 1.0 / 81;
double b = 0;
for (int i = 0; i < 729; ++ i)
    b += a;
printf("%.15g\n", b); // prints 8.99999999999996

Also, the maximum value of float is about 3e38, but double is about 1.7e308, so using float can hit "infinity" (i.e. a special floating-point number) much more easily than double for something simple, e.g. computing the factorial of 60.

During testing, maybe a few test cases contain these huge numbers, which may cause your programs to fail if you use floats.


Of course, sometimes, even double isn't accurate enough, hence we sometimes have long double[1] (the above example gives 9.000000000000000066 on Mac), but all floating point types suffer from round-off errors, so if precision is very important (e.g. money processing) you should use int or a fraction class.


Furthermore, don't use += to sum lots of floating point numbers, as the errors accumulate quickly. If you're using Python, use fsum. Otherwise, try to implement the Kahan summation algorithm.


[1]: The C and C++ standards do not specify the representation of float, double and long double. It is possible that all three are implemented as IEEE double-precision. Nevertheless, for most architectures (gcc, MSVC; x86, x64, ARM) float is indeed a IEEE single-precision floating point number (binary32), and double is a IEEE double-precision floating point number (binary64).

Answer from kennytm on Stack Overflow
๐ŸŒ
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.
Published: May 23, 2026
๐ŸŒ
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.
Discussions

c++ - What is the difference between float and double? - Stack Overflow
The size of the numbers involved in the float-point calculations is not the most relevant thing. It's the calculation that is being performed that is relevant. In essence, if you're performing a calculation and the result is an irrational number or recurring decimal, then there will be rounding errors when that number is squashed into the finite size data structure you're using. Since double ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Float vs double
IEEE754 is the answer to all your questions. That said, the general difference is that float is 32-bits in size and double is 64 bits. They can store different ranges of values with different precisions. I work in finance, and it seems that double is used exclusively. I am going to pretend that you are not storing currency values in floating point representation. Just for my own sanity. EDIT: I should note that the C++ standard does not require IEEE754 compliance, but it is the most widespread implementation of floating point arithmetic in modern processors. Although it is not the only method of doing so. More on reddit.com
๐ŸŒ r/cpp_questions
32
16
January 1, 2021
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
What is the size of float and double in C and C++? - Stack Overflow
I was looking to see if there is any standard type similar to uint32_t which always would map into a 32-bit unsigned integral type but I could not find any. Is the size of float always 4 byte on all More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ java โ€บ java numbers โ€บ float vs. double in java
Float vs. Double in Java | Baeldung
January 4, 2025 - A float is a 32-bit single-precision floating-point type, occupying four bytes of memory. This compact size makes it well-suited for memory-constrained environments like embedded systems and mobile devices.
Top answer
1 of 14
650

Huge difference.

As the name implies, a double has 2x the precision of float[1]. In general a double has 15 decimal digits of precision, while float has 7.

Here's how the number of digits are calculated:

double has 52 mantissa bits + 1 hidden bit: log(253)รทlog(10) = 15.95 digits

float has 23 mantissa bits + 1 hidden bit: log(224)รทlog(10) = 7.22 digits

This precision loss could lead to greater truncation errors being accumulated when repeated calculations are done, e.g.

float a = 1.f / 81;
float b = 0;
for (int i = 0; i < 729; ++ i)
    b += a;
printf("%.7g\n", b); // prints 9.000023

while

double a = 1.0 / 81;
double b = 0;
for (int i = 0; i < 729; ++ i)
    b += a;
printf("%.15g\n", b); // prints 8.99999999999996

Also, the maximum value of float is about 3e38, but double is about 1.7e308, so using float can hit "infinity" (i.e. a special floating-point number) much more easily than double for something simple, e.g. computing the factorial of 60.

During testing, maybe a few test cases contain these huge numbers, which may cause your programs to fail if you use floats.


Of course, sometimes, even double isn't accurate enough, hence we sometimes have long double[1] (the above example gives 9.000000000000000066 on Mac), but all floating point types suffer from round-off errors, so if precision is very important (e.g. money processing) you should use int or a fraction class.


Furthermore, don't use += to sum lots of floating point numbers, as the errors accumulate quickly. If you're using Python, use fsum. Otherwise, try to implement the Kahan summation algorithm.


[1]: The C and C++ standards do not specify the representation of float, double and long double. It is possible that all three are implemented as IEEE double-precision. Nevertheless, for most architectures (gcc, MSVC; x86, x64, ARM) float is indeed a IEEE single-precision floating point number (binary32), and double is a IEEE double-precision floating point number (binary64).

2 of 14
64

Here is what the standard C99 (ISO-IEC 9899 6.2.5 ยง10) or C++2003 (ISO-IEC 14882-2003 3.1.9 ยง8) standards say:

There are three floating point types: float, double, and long double. The type double provides at least as much precision as float, and the type long double provides at least as much precision as double. The set of values of the type float is a subset of the set of values of the type double; the set of values of the type double is a subset of the set of values of the type long double.

The C++ standard adds:

The value representation of floating-point types is implementation-defined.

I would suggest having a look at the excellent What Every Computer Scientist Should Know About Floating-Point Arithmetic that covers the IEEE floating-point standard in depth. You'll learn about the representation details and you'll realize there is a tradeoff between magnitude and precision. The precision of the floating point representation increases as the magnitude decreases, hence floating point numbers between -1 and 1 are those with the most precision.

๐ŸŒ
Codefinity
codefinity.com โ€บ blog โ€บ Float-vs-Double
Float vs Double
Float is typically used when the data does not require extreme precision and memory bandwidth is more critical. This might be the case in applications like graphics processing where high performance is crucial but exact precision is less critical. For applications that require high precision and accuracy, such as complex scientific calculations or financial algorithms where small errors can significantly affect outcomes, double is generally preferred despite its higher resource consumption.
Find elsewhere
๐ŸŒ
Reddit
reddit.com โ€บ r/learnprogramming โ€บ float vs. double โ€“ what's the key difference?"
r/learnprogramming on Reddit: float vs. double โ€“ What's the Key Difference?"
November 2, 2024 - 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.
Top answer
1 of 7
22

Excerpt from the C99 standard, normative annex F (The C++-standard does not explicitly mention this annex, though it includes all affected functions without change per reference. Also, the types have to match for compatibility.):

IEC 60559 floating-point arithmetic

F.1 Introduction

1 This annex specifies C language support for the IEC 60559 floating-point standard. The IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for microprocessor systems, second edition (IEC 60559:1989), previously designated IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE 754โˆ’1985). IEEE Standard for Radix-Independent Floating-Point Arithmetic (ANSI/IEEE 854โˆ’1987) generalizes the binary standard to remove dependencies on radix and word length. IEC 60559 generally refers to the floating-point standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that defines __STDC_IEC_559__ shall conform to the specifications in this annex.356) Where a binding between the C language and IEC 60559 is indicated, the IEC 60559-specified behavior is adopted by reference, unless stated otherwise. Since negative and positive infinity are representable in IEC 60559 formats, all real numbers lie within the range of representable values.

So, include <math.h> (or in C++ maybe <cmath>), and test for __STDC_IEC_559__.

If the macro is defined, not only are the types better specified (float being 32bits and double being 64bits among others), but also the behavior of builtin operators and standard-functions is more specified.
Lack of the macro does not give any guarantees.

For x86 and x86_64 (amd64), you can rely on the types float and double being IEC-60559-conformant, though functions using them and operations on them might not be.

2 of 7
14

Does not say anything about the size.

3.9.1.8

There are three floating point types: float, double, and long double. The type double provides at least as much precision as float, and the type long double provides at least as much precision as double. The set of values of the type float is a subset of the set of values of the type double; the set of values of the type double is a subset of the set of values of the type long double. The value representation of floating-point types is implementation-defined. Integral and floating types are collectively called arithmetic types. Specializations of the standard template std::numeric_limits (18.3) shall specify the maximum and minimum values of each arithmetic type for an implementation.

๐ŸŒ
Ask Any Difference
askanydifference.com โ€บ home โ€บ software โ€บ float vs double: difference and comparison
Float vs Double: Difference and Comparison
January 30, 2022 - Float and double are both data ... and storage size: float represents single-precision floating-point numbers with 32 bits, while double represents double-precision floating-point numbers with 64 bits, offering higher precision ...
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ what-is-the-difference-between-float-and-double
What is the difference between float and double?
A float has 7 decimal digits of precision and occupies 32 bits. A 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.
๐ŸŒ
Unstop
unstop.com โ€บ home โ€บ blog โ€บ 10+ difference between float and double explained (+examples)
10+ Difference Between Float And Double Explained (+Examples)
December 3, 2024 - Double: Slower than float because of its size, but it ensures precise calculations, reducing the risk of cumulative errors.
๐ŸŒ
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 - Double is a 64-bit floating-point number, which means that it can store up to 15 decimal digits accurately. Choose from our industry-leading programs designed for career success ... The float keyword in Java is a primitive data type, and its size limit is 4 byte or 32 bits (1 byte = 8 bits) ...
๐ŸŒ
FavTutor
favtutor.com โ€บ blogs โ€บ java-float-vs-double
Java: Float vs Double | 4 Main Differences (& when to use?) | FavTutor
February 23, 2021 - So, here are 4 main differences between float and double in Java: Size: Float is of size 32 bits while double is of size 64 bits. Hence, double can handle much bigger fractional numbers than float.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ c-float-and-double
C Float and Double - GeeksforGeeks
June 12, 2026 - Double is used to store double precision floating point values. It is the greater version of float which can store real numbers with precision up to 15 decimal places. The size of the double is 8 bytes.
๐ŸŒ
C++ Better Explained
cppbetterexplained.com โ€บ home โ€บ posts โ€บ c++ float vs double: which one should you use? | cppbe
C++ float vs double: Which One Should You Use? | CppBE
July 29, 2026 - C++ float vs double explained: float uses 4 bytes and ~7 digits, double uses 8 bytes and ~15. Learn which to pick and why double is the safer default.
๐ŸŒ
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 - Float is a 32-bit single-precision type, while double is a 64-bit double-precision type. Double offers greater accuracy and range. This makes it ideal for complex calculations, whereas float suits applications with limited memory and less stringent ...
๐ŸŒ
Tech Differences
techdifferences.com โ€บ home โ€บ difference between float and double
Difference Between Float and Double (with Comparison Chart) - Tech Differences
December 25, 2019 - The primary difference between float and double is that the float type has 32-bit storage. On the other hand, the double type has 64-bit storage
๐ŸŒ
tutorialpedia
tutorialpedia.org โ€บ blog โ€บ what-is-the-difference-between-float-and-double
Float vs Double: Key Differences Explained, When They're Interchangeable & When to Use Each โ€” tutorialpedia.org
Because the leading 1 in normalized binary numbers ($1.b_1b_2b_3...$) is implicit, the effective precision is 24 bits for float and 53 bits for double. ... Why it matters: While 4 bytes difference is negligible for a single variable, memory ...
๐ŸŒ
W3schools
w3schools.in โ€บ difference-float-double-data-types
Difference Between Float and Double Data Types - W3schools
Though Float and Double both of them are used for assigning real (or decimal) values in programming there is a major difference between these two data types.