One idea for squeezing in some more frequently used constants into
a 16-bit floating point formats is to allow some space for periodic
binary fractions in the last few bits.
An example of a possible encoding:
One bit for sign.
Four bits of exponent.
Two bits to encode the length of the final period:
00 for period 2
01 for period 3
10 for period 4
11 for period 6
Nine bits of mantissa
This would allow exact encoding of constants like 0.1 (period 4),
1./3. (period 2), 1./7 (period 3) or 1./9. (period 6). Fractions
of two could then be encoded with 00 as the final two bits.
Rounding would be included.
1./25. would not work because of a peridod of length 20.
On 4/25/2026 7:21 AM, Thomas Koenig wrote:
One idea for squeezing in some more frequently used constants into
a 16-bit floating point formats is to allow some space for periodic
binary fractions in the last few bits.
An example of a possible encoding:
One bit for sign.
Four bits of exponent.
Two bits to encode the length of the final period:
00 for period 2
01 for period 3
10 for period 4
11 for period 6
Nine bits of mantissa
This would allow exact encoding of constants like 0.1 (period 4),
1./3. (period 2), 1./7 (period 3) or 1./9. (period 6). Fractions
of two could then be encoded with 00 as the final two bits.
Rounding would be included.
1./25. would not work because of a peridod of length 20.
Seems like a clever idea, may need to look into this, and evaluate its
cost and effectiveness.
Cheaper hardware encoding could be possible if the format were designed
to keep more in common with Binary16, say:
0,S.E5.M10
1,S.E5.M8.P2
If actual 16-bits are needed, could sacrifice the sign bit as FPU
immediate values are overwhelmingly positive.
Then, the high-order bits are unpacked the same as for Binary16, but if
the high bit is set it tries to unpack the repeating pattern (into a 12-
bit GCF of similar, with the last partial segment applying RNE).
I have yet to evaluate how this would effect hit-rate though.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,116 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 85:27:02 |
| Calls: | 14,305 |
| Files: | 186,338 |
| D/L today: |
647 files (184M bytes) |
| Messages: | 2,525,478 |