For a normal half-precision floating-point number, write the stored fields as sign , biased exponent and ten-bit fraction . The value is for . The leading one is implicit: the ten stored fraction bits give eleven significant binary digits including that one. The normalized binary representations and stored fields are
| Value | Normalized binary representation | Sign, biased exponent, fraction |
|---|---|---|
0 01110 0000000000 | ||
0 01110 0100000000 | ||
1 01100 1000000000 | ||
0 10010 1111000000 |
Thus the four 16-bit words areEvery conversion is exact: all four numbers have terminating binary representations within the available precision.
Both signs are positive, so perform addition of the aligned significands. The true exponents are and , a difference of four. Shift the smaller significand right four places, retaining its low bits:Add at the common exponent:Renormalization raises the true exponent to and the biased exponent to . There are only seven fraction places to retain, so no floating-point rounding changes the result:The complete word is
0100110000001000.The smallest positive normal half-precision floating-point number uses and a zero fraction, while the largest uses and all ten fraction bits equal to one. HenceThe corresponding words are
0 00001 0000000000 and 0 11110 1111111111. The stored exponent is reserved and cannot extend the finite normal range.For a subnormal number, and the implicit leading bit becomes zero, while the scale remains . The least positive nonzero fraction is , givingUsing scale here would be incorrect: the subnormal number convention uses the minimum normal scale, not the ordinary biased-exponent formula at .
For the unsigned interpretation of the binary string, the set positions have weights . ThusIn 16-bit two's complement, the most significant bit is set, so subtract from that unsigned interpretation:For a half-precision floating-point number, split the fields at their actual boundaries rather than the printed groups of four:The sign is negative, the true exponent is , and the fraction is . It is a normal finite value, so
Articles by others on the same topic
There are currently no matching articles.