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.
Float | Double |
---|---|
This is generally used for graphic based libraries for making the processing power of your programs faster, as it is simpler to manage by compilers. | This is the most commonly used data type in programming languages for assigning values having a real or decimal based number within, such as 3.14 for pi. |
It has single precision. | It has the double precision or you can say two times more precision than float. |
According to IEEE, it has a 32-bit floating point precision. | According to IEEE, it has a 64-bit floating point precision. |
Float takes 4 bytes for storage. | Double takes 8 bytes for storage. |
A value having a range within 1.2E-38 to 3.4E+38 can be assigned to float variables. | A value having range within 2.3E-308 to 1.7E+308 can be assigned to double type variables |
Has a precision of 6 decimal places. | Has a precision of 15 decimal places. |