Differences between float and double

Points

Float

Double

Precision Float is single precision IEEE 754 floating point which provides precision up to 7 decimal points. Double is double precision IEEE 754 floating point that provides precision up to 15 decimal points.
Memory   Usage      Float uses 32 bits or 4 bytes of memory. Double uses 64 bits or 8 bytes of memory.
Range Float can store values varying from 3.4 x 10-38 to 3.4 x 10+38. The range of double is 1.7×10-308 to 1.7×10+308.
Format Specifier %f is the format specifier for float. %lf is the format specifier for double.
Memory Representation Sign = 1 bit
Exponent = 8 bits
Mantissa = 23 bits
Sign = 1 bit
Exponent = 11 bits
Mantissa = 52 bits

C Float and Double

Float and double are two primitive data types in C programming that are used to store decimal values. They both store floating point numbers but they differ in the level of precision to which they can store the values.

In this article, we will study each of them in detail, their memory representation, and the difference between them.

Similar Reads

Float

Float is used to store single-precision floating point numbers. It can store decimal values with precision up to 6-7 decimal places....

Double

...

How float and double are stored?

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....

Differences between float and double

...

Conclusion

C language follows the IEEE 754 standard for representing floating point values in the memory. Unlike the int type that is directly stored in the memory in binary form, the float values are divided into two parts: exponent and mantissa, and then stored....