Fun With Floats in Quintus

R. Kym Horsell vu0310 at bingvaxu.cc.binghamton.edu
Wed Aug 15 03:24:13 AEST 1990


In article <1990Aug14.034632.5561 at twinsun.com> eggert at twinsun.com (Paul Eggert) writes:
>with IEEE double precision floating point, the closest representable number to
>8.1 is X = 8.0999999999999996447286321199499070644378662109375.  But when I

While my sun and sparc came up with the same rep as you(rs),
I don't think it is the *closest* one to 8.1 in 55 bits of mantissa.

Since 8.1 is hex 81[9's]8 where the lsb of "8" is the 56th bit,
it rounds up (since the next bits after the 55th are 1100) to
81[9's]a which gives:

8.100000000000000088817841970012523233890533447265625

[I became sus when my vax gave 8.1[0's]1 for a double 8.1].

Maybe a few C printf's need overhaul, besides the point of rounding
to the nearest number in significant decimal digits.

-Kym Horsell



More information about the Comp.lang.c mailing list