Here you will learn about difference between float and double i.e. float vs double.
These are two commonly used floating point data types in programming languages like C, C++, Java, etc. Both float and double are used to store values with decimal point but there are some differences between them that are mentioned below.
float vs double – Difference between float and double
Float | Double | |
Precision | Single precision (1 bit for sign, 8 bits for exponent, 23 bits for fraction) | Double precision (1 bit for sign, 11 bits for exponent, 52 bits for fraction) |
Size | 4 Bytes (32 Bits) | 8 Bytes (64 Bits) |
Range | -3.4E+38 to +3.4E+38 | -1.7E+308 to +1.7E+308 |
Accuracy | 6 decimal digits | 15 decimal digits |
Comment below if you have queries related to above tutorial for float vs double.