Difference between Float and Double

Float Vs. Double: Explore the Difference between Float and Double

In C++, both float and double are the different data types used to save numbers with commas. Let’s explore the differences between float and double.

What is Float?

In the programming world, a float is a data type and 32 bits variable that permits you to store real numbers with fractional components and with commas.

What is Double?

Double is also a data type and 64 bit variable used to store large or real numbers that have fractional values.

Difference between float and double in C/C++

S.No. FLOAT DOUBLE
1 Single Precision data-type. Double precision data type.
2 Float data types can store up to 7 digits. Double data type can store up to 15 digits
3 The format specifier for float is %f. The format specifier for double is %lf.
4 It is a 32-bit floating-point data type. It is a 64-bit floating-point data type.
6 It demands 4-bytes of memory space. It demands 8-bytes of memory space.
7 It has 6-digits of precision. It has 15-digits of precision.
8 It is affordable and consumes less memory space. It is costlier, consumes more memory space.

Keep learning and stay tuned to get the latest updates on GATE 2022 along with GATE Preparation Books & GATE Answer Key and more.

Leave a Comment

Your Mobile number and Email id will not be published. Required fields are marked *

*

*