[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gawk infinity issues
From: |
Andrew J. Schorr |
Subject: |
gawk infinity issues |
Date: |
Thu, 5 Jan 2006 17:11:26 -0500 |
User-agent: |
Mutt/1.4.1i |
There seems to be some inconsistent behavior regarding how
the string representing plus or minus infinity is converted
to a numeric value.
Consider this simple script under gawk 3.1.5:
BEGIN {
x = sprintf("%s",-log(0))
print x, x+0
x = sprintf("%s",log(0))
print x, x+0
}
On linux/x86, it prints:
inf 0
-inf 0
But on Solaris 8/sparc, it prints:
Inf 0
-Inf -Inf
I'm not sure what the correct result should be, but it
seems to depend on the code in node.c:r_force_number()
and whether it gets to the strtod() call and how
strtod() handles the string.
I think there must be a bug here somewhere. Is it clear
what the proper behavior should be? It seems to me this
should probably be another test case...
Regards,
Andy
infinity.awk
Description: Text document
- gawk infinity issues,
Andrew J. Schorr <=