The bug exposed by 2#_1e6 is one worth remembering for
telling your grandchildren.
2#_1e6 NB. wrong
_1000000 _475712
When moving sets of 8 bytes, there is a speed advantage
in moving them as 64 bit floats, so in doing n#_1e6 it is
faster to move n%2 sets of 64 bits each set of which is
2 repetitions of _1e6 :
3!:3 ] _1e6
e1000000
04000000
01000000
00000000
c0bdf0ff
But look what happens (in J602 gbeta or earlier):
3!:3 ]2#_1e6
e1000000
04000000
02000000
01000000
02000000
c0bdf0ff
c0bdf8ff
The c0bdf0ff (_1e6) got changed to c0bdf8ff (_475712).
3!:3 ]_.
e1000000
08000000
01000000
00000000
00000000
0000f8ff
It turns out that if you have a 64-bit pattern that looks like NaN,
on some compilers (or different versions of the same compiler)
the generated code quietly changes a bit from 0 to 1. Another
manifestation of the bug is as follows (in J602 gbeta or earlier):
x=: 240 255{a.
y=: 8$x
y = 0 1 0 1 0 1 0 1 {x
1 1 1 1 1 1 0 1
We'd actually discovered this interesting "feature" at around 2000,
but a recent compiler upgrade by one of us at Jsoftware exposed
the problem anew. The situation is that in C, when x and y are
doubles and you execute the C statement
x=y;
it is possible for x and y to be not bit-by-bit identical.
Another reason for my dislike of NaN.
----- Original Message -----
From: Eric Iverson <[EMAIL PROTECTED]>
Date: Friday, February 1, 2008 12:51
Subject: [Jbeta] J32 Windows hbeta available
To: Beta forum <[email protected]>
> J32 Windows hbeta is available.
>
> This beta fixes a serious bug that has been in all J32 Windows
> betas to
> date. The bug causes wrong answers and users should promptly
> move to the
> hbeta.
>
> The bug was introduced by our change to the new MS compiler and
> affects only
> J32 Windows.
>
> Our thanks to Alexandr Batalshikov for initially reporting this
> problem
> (2#_1000000 _1000000). And persisiting in pointing it out again
> after it
> fell through the cracks.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm