[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gawk infinity issues
From: |
Andrew J. Schorr |
Subject: |
Re: gawk infinity issues |
Date: |
Sat, 7 Jan 2006 11:47:18 -0500 |
User-agent: |
Mutt/1.4.1i |
On Fri, Jan 06, 2006 at 09:20:41PM -0500, John Cowan wrote:
> In that case, a --traditional switch or TRADITIONAL environment variable
> could be used to preserve the old behavior. In 1979, inf and nan were
> not part of the floating-point landscape.
Agreed. I'm starting to think that this should be controllable by
the user. For our site, understanding NaN and Inf as numeric values clearly
makes sense. But others seem to prefer the old traditional behavior.
FYI, "make check" passes all tests with the patch I sent previously.
At the end of the day, the question is what do you want the output
of this command to be:
Unpatched gawk 3.1.5 on linux:
$./gawk 'BEGIN {print "nan"+0,"-nan"+0,"inf"+0,"-inf"+0}'
0 0 0 0
And with my patch on linux:
$ ./gawk 'BEGIN {print "nan"+0,"-nan"+0,"inf"+0,"-inf"+0}'
nan nan inf -inf
Unpatched gawk 3.1.5 on solaris 8/sparc:
$ ./gawk 'BEGIN {print "nan"+0,"-nan"+0,"inf"+0,"-inf"+0}'
0 -NaN 0 -Inf
Patched gawk on solaris 8:
$ ./gawk 'BEGIN {print "nan"+0,"-nan"+0,"inf"+0,"-inf"+0}'
NaN -NaN Inf -Inf
Other versions of awk:
Mawk 1.3.3 on linux:
$ ./mawk 'BEGIN {print "nan"+0,"-nan"+0,"inf"+0,"-inf"+0}'
nan nan inf -inf
Pawk-20030606 on linux:
$ ./pawk 'BEGIN {print "nan"+0,"-nan"+0,"inf"+0,"-inf"+0}'
nan nan inf -inf
Nawk on Solaris 8/sparc:
$ nawk 'BEGIN {print "nan"+0,"-nan"+0,"inf"+0,"-inf"+0}'
NaN -NaN Inf -Inf
Old awk on solaris 8/sparc:
$ awk 'BEGIN {print "nan"+0,"-nan"+0,"inf"+0,"-inf"+0; exit}'
0 0 0 0
Awka 0.7.5 on linux:
$ ./awka 'BEGIN {print "nan"+0,"-nan"+0,"inf"+0,"-inf"+0}' > /tmp/test.c
$ gcc -I ../include /tmp/test.c ../lib/libawka.a -lm -o /tmp/testprog
$ /tmp/testprog
nan nan inf -inf
So it seems that every other modern version of awk treats those
strings as numeric values. Why should gawk be different?
Regards,
Andy
- Re: gawk infinity issues, (continued)
- Re: gawk infinity issues, Aharon Robbins, 2006/01/05
- Re: gawk infinity issues, Andrew J. Schorr, 2006/01/06
- Re: gawk infinity issues, Paul Eggert, 2006/01/06
- Re: gawk infinity issues, Andrew J. Schorr, 2006/01/06
- Re: gawk infinity issues, Paul Eggert, 2006/01/06
- Re: gawk infinity issues, John Cowan, 2006/01/06
- Re: gawk infinity issues,
Andrew J. Schorr <=
Re: gawk infinity issues, Aharon Robbins, 2006/01/08