From: Joel VanderWerf Date: 2009-04-29T10:10:27+09:00 Subject: Re: Detecting -0.0 Pascal J. Bourguignon wrote: > Gary Wright writes: >> [...] >> A quick look at the IEEE format suggests that there are (2^51 - 1) bit >> patterns that are all considered NaN (not a number). >> >> Seems like it might be possible to encode Ruby references in there. >> >> Does anyone know of a language implementation that tags references in >> that way? > > Some specific NaN are produced by arithmetic operations. > Does IEEE forbid a FP unit to generate any NaN for some operations? > > It would seem to me to be dangerous to be able to produce random > references from arithmetic operations... The interpreter would have to add code to check for that and replace with some canonical NaN that doesn't conflict. The ruby runtime already has to call rb_float_new() on the result of every floating point function. Doing this check instead would be less overhead. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407