libcg / bfp

Beyond Floating Point - Posit C/C++ implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect handling of partial exponent fields

leobru opened this issue · comments

Using Posit(8, 2):

{8, 2} 01111010 (3) -> +11110 10 = 16384
x2
{8, 2} 01111011 (3) -> +11110 11 = 32768
x2
{8, 2} 01111100 (4) -> +111110 0 = 65536
x2
{8, 2} 01111101 (4) -> +111110 1 = 131072
x8
{8, 2} 01111110 (5) -> +1111110 = 1.04858e+06
x16
{8, 2} 01111111 (6) -> +1111111 = 1.67772e+07

Evidently, the value for 01111101 is incorrect. It should be 262144, so that the ratios between adjacent values would be x2 x2 x4 x4 x16, with gradual logarithmic spacing.

In other words, partial exponent fields represent the high bits of the full exponent field of width "es".

Nice catch! I'm on it.

Fixed with e50895d.

{8, 2} 01111010 (3) -> +11110 10 = 16384
{8, 2} 01111011 (3) -> +11110 11 = 32768
{8, 2} 01111100 (4) -> +111110 0 = 65536
{8, 2} 01111101 (4) -> +111110 1 = 262144
{8, 2} 01111110 (5) -> +1111110 = 1.04858e+06
{8, 2} 01111111 (6) -> +1111111 = 1.67772e+07