Floating point

Steps for converting to floating point binary

1. Convert to binary
  3.1875
  2
- 1
__________
  0.1875
- 0.1250
_________
  0.0625  
  0.0625
-
_________
       0

|2^2|2^1|2^0|2^-1|2^-2|2^-3 | 2^-4|
| 4 | 2 | 1 | .5 | .25|0.125|.0625|
| 0 | 1 | 1 | 0  | 0  |  1  |  1  |

2. Convert to floating point
1.10011 x 10 ^ 1

3. sign bit = 0
4. 127 + 1 = 128 // One is derived from the power in the scientific notation, 127 needs to be added
5. Pad the decimal bits out to 23 bits (10011)
1011 000000000000000000

6.
Add

[sign-bit] + [exponent bits] + [fraction bits]
   0       +    10000000     + 101100000000000000000000

0100 0000 0100 1100 0000 0000 0000 0000
0x404C0000

-127 -> 128 
Written on September 18, 2017