Step One: Convert decimal number to binary representation. (23) 10 = (10111) 2 and : (0.5) 10 = (0.1) 2
We get (23.5) 10 = (10111.1) 2
Step Two: Move radix to point to 1.xxxx.* 2 exp representation.
10111.1 1.01111 * 2 4
Step Three: Put it all together
Assign the sign bit (S=0). Mantissa. Remember to ignore the leading 1. In this case 1.01111 => 01111000000000000000000 Exponent. Add 127 to the exponent and get: 127 + 4 = 131. Convert 131 to binary: (131) 10 = (10000011) 2
Example 2) Represent the decimal number 46.875 in 32-bit floating point binary format:
Step One: Convert decimal number to binary representation. (46) 10 = (101110) 2 and : (0.875) 10 = (0.5 + 0.25+ 0.125) 10 => (0.111) 2
We get (46.875) 10 = (101110.111) 2
Step Two: Move radix to point to 1.xxxx.* 2 exp representation.
101110.111 1.01110111 * 2 5
Step Three: Put it all together
Assign the sign bit (S=0). Mantissa. Remember to ignore the leading 1. In this case 1.01110111 => 01110111000000000000000 Exponent. Add 127 to the exponent and get: 127 + 5 = 132. Convert 132 to binary: (132) 10 = (10000100) 2