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
๐ŸŒ
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.
๐ŸŒ
Programiz
programiz.com โ€บ cpp-programming โ€บ float-double
C++ float and double | Programiz
August 23, 2024 - However, since float has a precision of up to only 7 digits, it shows garbage values after its precision is exceeded. Our double variable shows the correct number because it has a precision of 15 digits, while the number itself consists of 13 digits.
Discussions

float vs. double โ€“ What's the Key Difference?"
There's usually not an appreciable performance difference between single operations on floats and doubles, but when you do a lot of operations on a lot of numbers, you can get performance benefits from being able to load 2x of them with the same memory bandwidth, and do 2x the operations in similar time by packing in more SIMD lanes with a few cycles less for each. ... Quick example... More on reddit.com
๐ŸŒ r/learnprogramming
12
16
November 2, 2024
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
floating point - Difference between decimal, float and double in .NET? - Stack Overflow
Pretty much all modern systems, even cell phones, have hardware support for double; and if you game has even simple physics, you will notice a big difference between double and float. (For example, calculating the velocity / friction in a simple Asteroids clone, doubles allow acceleration to ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Why would I use float data type instead of double? (C++)

double has more precision and is larger than a float. Generally, a double is 8 bytes and a float is 4 bytes. But sometimes you don't need that extra precision, and a float can work fine. So hence sometimes use float instead of a double. i.e. why waste space using a double if you don't need that extra precision?

More on reddit.com
๐ŸŒ r/learnprogramming
4
2
January 19, 2019
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.

๐ŸŒ
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?
Assign a value within the range of a float. ... 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
๐ŸŒ
Codefinity
codefinity.com โ€บ blog โ€บ Float-vs-Double
Float vs Double
Python does not have a separate float and double type distinction. It uses double precision floating-point numbers for all decimal values. Here's how you define a floating point number in Python: my_float = 3.14 # Python uses 64-bit IEEE 754 double precision by default ยท JavaScript does not differentiate between different types of floating point numbers; it only has one data type for decimals โ€” number, which is implemented as double-precision floating point according to IEEE 754.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ what-is-the-difference-between-float-and-double
What is the difference between float and double?
Float and double are both widely used data types in programming that have the ability to store decimal or floating-pointโ€‹ numbers. The only difference between them is the precision.
๐ŸŒ
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 has limited precision and a smaller range, which can lead to rounding errors and issues with very large or very small numbers. Itโ€™s also prone to overflow and underflow in extreme cases.
Find elsewhere
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ double-vs-float-in-cpp-the-difference-between-floats-and-doubles
Double VS Float in C++ โ€“ The Difference Between Floats and Doubles
May 19, 2022 - The byte size for float is 4 while the byte size for double is 8. This implies that double can store values that are twice the amount that float can hold. We can see this by using the sizeof() operator.
๐ŸŒ
Hackr
hackr.io โ€บ home โ€บ articles โ€บ programming
Float vs Double Data Types: What's The Difference [Updated]
January 30, 2025 - This leads me to my main point: ... application's needs. For example, If you need to conserve memory and your calculations don't require extreme precision, Floats might be sufficient....
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ java โ€บ java numbers โ€บ float vs. double in java
Float vs. Double in Java | Baeldung
January 4, 2025 - In contrast, a double is a 64-bit double-precision floating-point type, requiring eight bytes of memory. While it demands more storage, this larger size allows it to represent values with higher precision and a broader range, making it indispensable ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c++ โ€บ difference-float-double-c-cpp
Difference between float and double in C/C++ - GeeksforGeeks
June 23, 2023 - What's the difference? double has 2x more precision than float. float is a 32-bit IEEE 754 single precision Floating Point Number - 1 bit for the sign, 8 bits for the exponent, and 23* for the value. float has 7 decimal digits of precision. ...
๐ŸŒ
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 - There's usually not an appreciable performance difference between single operations on floats and doubles, but when you do a lot of operations on a lot of numbers, you can get performance benefits from being able to load 2x of them with the same memory bandwidth, and do 2x the operations in similar time by packing in more SIMD lanes with a few cycles less for each. ... Quick example: float pi_float = 3.14159265359f; // Stores as 3.1415927 double pi_double = 3.14159265359; // Stores as 3.14159265359
๐ŸŒ
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 - It's also best practice to choose ... of the main difference between float and double is that (i) Float requires 4 bytes of storage while double requires 8 bytes....
๐ŸŒ
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 allocation scales linearly with dataset size:
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.

๐ŸŒ
Study.com
study.com โ€บ business courses โ€บ java programming tutorial & training
Java: Float vs. Double - Lesson | Study.com
July 21, 2018 - I can research almost any subject, delve into it more deeply if I wish, and begin studying at a deeper level right away. Catherine S. ... Typically, a double scoop of ice cream is more than a float. The same is true in Java, but on a different scale.
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ difference between float and double in c/c++
Difference between float and double in C/C++ - Scaler Topics
April 22, 2024 - In this case, a float data type might be utilized because minor differences in decimal values would not significantly influence gameplay. On the other hand, when dealing with exact measurements in astronomical investigations, a double data type assures that no delicate information is lost. ...
๐ŸŒ
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.
๐ŸŒ
Tech Differences
techdifferences.com โ€บ home โ€บ difference between float and double
Difference Between Float and Double (with Comparison Chart) - Tech Differences
December 25, 2019 - Float and Double both are the data types under Floating-point type. The Floating-point numbers are the real numbers that have a fractional component in it. The primary difference between float and double is that the float type has 32-bit storage.
Top answer
1 of 16
2635

float (the C# alias for System.Single) and double (the C# alias for System.Double) are floating binary point types. float is 32-bit; double is 64-bit. In other words, they represent a number like this:

10001.10010110011

The binary number and the location of the binary point are both encoded within the value.

decimal (the C# alias for System.Decimal) is a floating decimal point type. In other words, they represent a number like this:

12345.65789

Again, the number and the location of the decimal point are both encoded within the value โ€“ that's what makes decimal still a floating point type instead of a fixed point type.

The important thing to note is that humans are used to representing non-integers in a decimal form, and expect exact results in decimal representations; not all decimal numbers are exactly representable in binary floating point โ€“ 0.1, for example โ€“ so if you use a binary floating point value you'll actually get an approximation to 0.1. You'll still get approximations when using a floating decimal point as well โ€“ the result of dividing 1 by 3 can't be exactly represented, for example.

As for what to use when:

  • For values which are "naturally exact decimals" it's good to use decimal. This is usually suitable for any concepts invented by humans: financial values are the most obvious example, but there are others too. Consider the score given to divers or ice skaters, for example.

  • For values which are more artefacts of nature which can't really be measured exactly anyway, float/double are more appropriate. For example, scientific data would usually be represented in this form. Here, the original values won't be "decimally accurate" to start with, so it's not important for the expected results to maintain the "decimal accuracy". Floating binary point types are much faster to work with than decimals.

2 of 16
1305

Precision is the main difference.

Float - 7 digits (32 bit)

Double-15-16 digits (64 bit)

Decimal -28-29 significant digits (128 bit)

Decimals have much higher precision and are usually used within financial applications that require a high degree of accuracy. Decimals are much slower (up to 20X times in some tests) than a double/float.

Decimals and Floats/Doubles cannot be compared without a cast whereas Floats and Doubles can. Decimals also allow the encoding or trailing zeros.

float flt = 1F/3;
double dbl = 1D/3;
decimal dcm = 1M/3;
Console.WriteLine("float: {0} double: {1} decimal: {2}", flt, dbl, dcm);

Result :

float: 0.3333333  
double: 0.333333333333333  
decimal: 0.3333333333333333333333333333