[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: |
Thu, 5 Jan 2006 18:32:20 -0500 |
User-agent: |
Mutt/1.4.1i |
On Thu, Jan 05, 2006 at 06:18:31PM -0500, Andrew J. Schorr wrote:
> Understood. But it still seems to me that gawk should have a clear policy
> (even if not defined by POSIX) on how it will convert to a number a string
> that contains a (platform-dependent) representation of Infinity or NaN.
> Or do you feel that this behavior need not be nailed down?
In other words, this seems strange to me:
On Solaris 8/sparc:
$ ./gawk -v x=inf 'BEGIN {print x+0}'
0
$ ./gawk -v x=-inf 'BEGIN {print x+0}'
-Inf
$ ./gawk -v x=nan 'BEGIN {print x+0}'
0
$ ./gawk -v x=-nan 'BEGIN {print x+0}'
-NaN
On linux/x86/32-bits:
$ ./gawk -v x=inf 'BEGIN {print x+0}'
0
$ ./gawk -v x=-inf 'BEGIN {print x+0}'
0
$ ./gawk -v x=nan 'BEGIN {print x+0}'
0
$ ./gawk -v x=-nan 'BEGIN {print x+0}'
0
On both platforms, the libc strtod() function recognizes the
strings "inf", "-inf", "nan", and "-nan", but the gawk code
seems to vary on whether it interprets the string using strtod.
Note that config.h defines STRTOD_NOT_C89 on linux (and uses gawk_strtod
instead), and not on solaris, and this seems to be a factor. It
doesn't look like gawk_strtod has any support for nan or inf.
Regards,
Andy
- gawk infinity issues, Andrew J. Schorr, 2006/01/05
- 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, 2006/01/07