On Fri, Sep 06, 2002 at 01:48:15AM +0900, William Djaja Tjokroaminata wrote:
> Well, currently int is usually 32 bits and most pointers are 32 bits and
> we already sacrifice one bit.  Therefore, when 64-pointers are standard,
> I guess at least in theory we can do the same thing to double.  Except, of
> course, we can judge how "nasty" it is, as compared to the performance
> that will be gained.  (Isn't it the structure of 'double' and 'float' has
> been standardized by IEEE a long time ago?)

There is a standard (ieee 754), but not everyone uses it.  There are
some systems out there that even use base-10 floating-point arithmetic
instead of base-2 like the rest of us.

Even if we assume that Ruby will only ever run on systems that use the
ieee recommendations, manipulating the bits in a double really isn't a
game we should play; it will probably give a lot of programmers
surprising results.  It would also require writing a test suite so we
can make sure we haven't broken anything (i.e. infinity/NaN are still
representable, addition/subtraction/etc. work for all combinations of
numbers, precision isn't lost except the precision we expect to lose by
throwing out a bit, etc.).  In short, it's just not worth the trouble.

Paul