Turned out I was calculating pos wrong from the outset, I now have a variant of this in big_make()
Code:
else {
for ( NUM = temp.one; NUM > temp.fpn; --pos, NUM >>= 1 );
if ( NUM == temp.fpn ) --pos;
if ( pos < temp.min_exp ) goto fpn_inf;
#if 1
if ( pos == -2 ) {
printb("fpn = ", &temp.fpn, 16 );
putchar('\n');
printb("one = ", &temp.one, 16 );
putchar('\n');
printf("pos = %ld\n", pos );
}
#endif
}
With this output:
Code:
gcc -Wall -o "test_fpn" "test_fpn.c" && "./test_fpn"
flex.exp_bias = 128
flex.exp_bits = 8
flex.max_exp_digits = 38
flex.min_exp_digits = -37
flex.max_exp = 128
flex.min_exp = -125
flex.man_bits = 23
limit for #.0e+/-#, 0.#e+/-#, #.#e+/-# is 5
fpn = 0000000000000011
one = 0000000000001010
pos = -2
fpn = 0000000000000100
one = 0000000000001010
pos = -2
fpn = 0000000000000101
one = 0000000000001010
pos = -2
gcc = 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111000000000000000000000000
mcc = 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111110100000000000000000000000
gcc.exp = 0000000001111110
mcc.exp = 0000000001111101
fpn t = 5.000000e-01 m = 2.500000e-01
one = 1, given 5.0e-1, value 5.0e-1
Tried = 36, Wrong = 1, Off By 1 = 0, Not Inf = 0, Was Inf = 0, Too Soon = 0, Too Late = 0
scenario = 0
Compilation finished successfully.