help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] BUG in sysdep.h (Smalltalk)


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] BUG in sysdep.h (Smalltalk)
Date: Sat, 28 Apr 2001 08:24:07 +0200

> /* These nice tests are simple, guaranteed and independent of byte order.
> */
> #define isFinite(dbl)           (((dbl) == (dbl)) && ((dbl) != ((dbl) *
> 1.5 + 1.0)))
>
> "So is -2.0 infinite" ?

Why not? :-)

You're right... and it's quite embarrassing.

But (dbl) != ((dbl) + 1.0)) is not correct either, because it would
make 1e20 infinite (closer than -2, but not right yet...)  I think
the right way is (!isNaN((dbl) * 0.0)).

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]