+ 3

what is the difference between int float and double

variables

5th Oct 2017, 8:22 PM
Abdullah alamodi
Abdullah alamodi - avatar
2 Respostas
+ 10
double has 2x more precision then float. float is a 32 bit IEEE 754 single precision Floating Point Number1 bit for the sign, (8 bits for the exponent, and 23* for the value), i.e. float has 7 decimal digits of precision. double is a 64 bit IEEE 754 double precision Floating Point Number (1 bit for the sign, 11 bits for the exponent, and 52* bits for the value), i.e. double has 15 decimal digits of precision.
5th Oct 2017, 8:52 PM
Scooby
Scooby - avatar
+ 5
An integer is a whole number, between -2,147,483,647 and 2,147,483,647 (32-bit integer, 16 and 64 integers also exist). A float is a number (including decimals) with a range between approximately -3.4 · 10^38 and 3.4 · 10^38. double also includes decimals, but between - 1.7 · 10^308 and  1.7 · 10^308. Note that both float and double are not exact types, meaning that ie. 1.7 · 10^308 may be represented with the same double value as 1.7 · 10^308 - 1 for more info, see ie http://en.cppreference.com/w/cpp/language/types
5th Oct 2017, 9:00 PM
ReneDaanen