The float format (IEEE) has 32 bits. First bit for the sign, after that 8 bits for a biased exponent and after that another 23 bits for the mantissa. In this mantissa is the first 1 (is always 1) always hidden which leads me to my question:
how does the number 0 look like in this format? because if the exponents 0 the number will always be 1. plus the mantissa is always minimum 1 right? If they are only zeros in the mantissa it will count as '1.0'...
I really don't get this.
Wikipedia tells you:
0000 0000 = 0
8000 0000 = −0
Besides the normal float values, with exponent and mantisse there are a bunch of other irregular numbers like zero, infinity and a bunch of NaNs. There are also subnormal numbers; where numbers below 2^-127 are approximated with fixed instead of a floating exponent.
Actually, zero is a normal subnormal number. Subnormals are encoded with as (−1)signbits×2^−126 × 0.significandbits
and exponent all zero. If significantbits is zero, the result is (+/-) zero.