----- Forwarded message from Boris Gaertner Boris.Gaertner@gmx.net -----
Delivered-To: mailman-squeak-dev@lists.squeakfoundation.org From: "Boris Gaertner" Boris.Gaertner@gmx.net To: "The general-purpose Squeak developers list" squeak-dev@lists.squeakfoundation.org Date: Tue, 14 Sep 2004 20:35:16 +0200 Subject: Re: [BUG] Float NaN's
"stéphane ducasse" ducasse@iam.unibe.ch wrote:
hi guys
Could one of you write a bunch of tests to record the correct behavior and add as comment the discussion of this email?
Stef
Attached you find a change set that contains additional tests for the class FloatTest. Comments are welcome.
Greetings, Boris
----- End forwarded message -----
"stéphane ducasse" ducasse@iam.unibe.ch wrote:
hi guys
Could one of you write a bunch of tests to record the correct behavior and add as comment the discussion of this email?
Stef
Attached you find a change set that contains additional tests for the class FloatTest. Comments are welcome.
Greetings, Boris
Hi, all:
I was temporarily bumped off the mailing list distribution, so I didn't see the flurry of Float NaN postings until now. I implemented the original "IEEE-ification" of the Float class, adding the NaNs, Infinities, stable printing, etc. The interaction of NaNs with Sets and Dictionary keys was a surprise, but it is interesting that it hadn't been discovered until recently (6+ years after the addition of NaNs with the behavior x == x, x ~= x).
Some comments on Boris' tests:
testNan2 is not portable; there is no reason for any particular floating-point library implementation to return NaN for sin / tan of values greater than 1e200. That is simply an artifact of Intel's x86 trancendental range reduction implementation.
You might also add a test for the difference of same-signed Infinities returning NaN:
Inf - Inf -> NaN Inf + -Inf -> NaN
In the testZero1 test:
self assert: (Float negativeZero at: 1) ~= (0 asFloat at: 1).
This can be written more understandably as:
Float negativeZero sign ~= 0 sign.
Additionally, you could add a testSign test which verified that sign works as above.
-- Tim Olson
squeak-dev@lists.squeakfoundation.org