IEEE 754 — single precision (32 bit)
A 32-bit floating-point number is divided into 1 sign bit, 8 exponent bits and 23 fraction bits.
The structure
1
8 bit
23 bit
For normalized numbers: (−1)S × 1,fraction × 2E−127. The value 127 is the bias.
Example: 5.75
5.75₁₀ = 101.11₂ = 1.0111₂ × 2²
Sign: 0. Unbiased exponent: 2. Stored exponent: 2 + 127 = 129 → 10000001.
The leading 1 of a normalized value is implicit; only the fractional part is stored:
01110000000000000000000
Result: 0 10000001 01110000000000000000000
Practice
Progress: 0/5 — correct: 0.
Encode 0.5 in IEEE 754 single precision.
Sign: 0. Write |0.5| in binary, normalize it as 1.f × 2ᵉ, then store e+127 on 8 bits. For this exercise the stored exponent is 01111110.
Special values
E = 00000000: zero or subnormal numbers. E = 11111111: infinity if the fraction is zero, NaN if the fraction is non-zero.