Sisyphus wrote:
But on the 2 machines I ran that code on (linux and Win32), IEEE NaN is not
supported - as evidenced by the fact that NaN + 1 == 1.

NaN is supported on both of those platforms (AFAIK), but the string "NaN" is not a canonical way to generate the special IEEE NaN number.

I also checked by
running (as suggested in perlop):

perl -le '$a = NaN; print "No NaN support here" if $a == $a'

I don't see support for that construct in the code at all (there is special INF and NaN handling in numeric.c:Perl_grok_number but this only bypasses the warning and doesn't affect the math), so I'm not sure that was ever anything more than wishful thinking. I think the thought was that there would be special handling so that this:

        $x = NaN; # note bareword not string

would autogenerate an actual NaN number, but it doesn't exist (AFAICT) in toke.c where it belongs.

However, Tels did add this support to bigint:

use bigint;
$x = NaN;
$x += 1;

$y = "foo";
$y += 1;

print $x, " ", $y, "\n";
__END__

produces the expected (or not in the second case):

NaN NaN

HTH

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747

Reply via email to