Back to ComputerTerms
Float Number format
Binary digits:
31 |
30 - 23 |
22 - 0 |
||
Sign Bit 0+, 1- |
Value = Exponent + 127 |
Significand |
We note that the Significand is really 1.significand * 2^Exponent which doesn't allow us to represent 0. To allow this if all bits are 0, the number is 0. Also the value stored in the exponent field is really the exponent + 127. This exponential bias allows floating point numbers to be sorted like a regular number +/- is most important, exponent next most important, mantissa/significand least important.
Thus the numbers will be:
0 |
127 |
0 |
In Binary this will look like this:
0 |
00001111111 |
00000000000000000000 |
Falicies and Pitfalls
- Floating-point addition is associative:
(-1.5e38 + 1.5e38) + 1 = 1 -1.5e38 + (1.5e38 + 1) = 0
- Since left shifts multiply by two, right shifts divide by two. Even if you take into consideration shifting in 1's, this doesn't always work!
Back to ComputerTerms