8-Bit Floating Point Conversion Step-by-Step
Classified in Mathematics
Written on in
English with a size of 6.16 KB
Converting Decimal to 8-Bit Floating Point
Example 1: Convert 2.625 to 8-Bit Format
- The integral part is calculated as: 210 = 102. For the fractional part:
So, 0.62510 = 0.1012, and 2.62510 = 10.1012.0.625 × 2 = 1.25 1 Generate 1 and continue with the rest. 0.25 × 2 = 0.5 0 Generate 0 and continue. 0.5 × 2 = 1.0 1 Generate 1 and nothing remains. - Add an exponent part: 10.1012 = 10.1012 × 20.
- Normalize: 10.1012 × 20 = 1.01012 × 21.
- Mantissa: 0101
- Exponent: 1 + 3 = 4 = 1002.
- Sign bit is 0.
The result is 0 100 0101. Represented as hex, that is 4516.
Example 2: Convert -4.75 to 8-Bit Format
- The integral part is 410 = 1002. The fractional part:
So, 4.7510 = 100.112.0.75 × 2 = 1.5 1 Generate 1 and continue with the rest. 0.5 × 2 = 1.0 1 Generate 1 and nothing remains. - Normalize: