November 2013
Beginner
325 pages
9h 47m
English
If you need a number with a decimal point, like 3.2, you use a floating-point number. Most programmers think of a floating-point number as a mantissa multiplied by 10 to an integer exponent. For example, 345.32 is thought of as 3.4532 x 102. And this is essentially how they are stored: a 32-bit floating number has 8 bits dedicated to holding the exponent (a signed integer) and 23 bits dedicated to holding the mantissa, with the remaining 1 bit used to hold the sign.
Like integers, floating-point numbers come in several sizes. Unlike integers, floating-point numbers are always signed:
float g; // 32 bits double h; // 64 bits long double i; // 128 bits
Read now
Unlock full access