[FIX][BUG] Float NaN's ( retracting patch for #testNaN2 )

Boris Gaertner Boris.Gaertner at gmx.net
Mon Sep 27 09:23:15 UTC 2004


From: <lewis at mail.msen.com>
on Sunday, September 26, 2004 4:56 PM
Subject: [FIX][BUG] Float NaN's ( retracting patch for #testNaN2 )


>
> Patch retracted, do not use it.
>
> Sorry, I hit "send" too soon. I don't think that my proposed patch
> captures the original intent of the test, which was to compare two NaN
> values with different bit patterns.
>
> Perhaps we are seeing different behavior for the #testNaN2 method when
> running Squeak on platforms with different C math libraries??? I am
> using an Intel Linux system. On this system, I have:
>   1.0e200 sin ==> 0.999823805637538
>   1.0e200 tan ==> 1.0
>

<sam at rfc1149.net> wrote:
on  Saturday, September 25, 2004 5:58 PM
Subject: [BUG] Float NaN's ( [er][et][su][sm] One test fails )


>
> Test #testNaN2 fail on FreeBSD. valueOfSin is -0.520131815022207, while
> valueOfTan is 1.0.
>
All this is very interesting.

I use Squeak in Windows, with an Intel Celeron. On that
platform  the expressions
1.0e200 sin   and  1.0e200 tan
answer two different representations of  NaN.

The Intel documentation (IA-32 Intel Architecture
Software Developer’s Manual)
says for instructions  FSIN  and  FPTAN:

<citation>
The source operand must be given in radians and must be
within the range -2^63 to +2^63.
</citation>
<citation>
If the source operand is outside the acceptable range, the
C2 flag in the FPU status word is set, and the value in register
ST(0) remains unchanged. The instruction does not raise an
exception when the source operand is out of range. It is up to
the program to check the C2 flag for out-ofrange conditions.

Source values outside the range -2^63 to +2^63 can be
reduced to the range of the instruction by subtracting an
appropriate integer multiple of 2*pi or by using the
FPREM instruction with a divisor of 2*pi. See the section
titled “Pi” in Chapter 8 of the IA-32 Intel Architecture
Software Developer’s Manual, Volume 1, for a discussion
of the proper value to use for pi in performing such reductions.
</citation>

In other words: The implementor of a maths library has the
permission to do whatever he thinks is suitable.

I think we have any reason to assume that we use different
math libraries.

Greetings, Boris




More information about the Squeak-dev mailing list