Subject: | 'nan' and 'inf' not quite working right |
I'm finding that recent perls (ie 5.8.9 to 5.12.2, with the exception
of 5.10.0) built using mingw.org's compilers (gcc-3.4.5, gcc-4.5.0)
produce (what I assume to be) intended output regarding numification of
strings that match /^nan/i and /^inf/i:
#########################
C:\>perl -wle "print 'nan' + 0"
-1.#IND
C:\>perl -wle "print 'InF' + 0"
1.#INF
C:\>perl -wle "print 'NanN' + 0"
Argument "NanN" isn't numeric in addition (+) at -e line 1.
-1.#IND
C:\>perl -wle "print 'iNff' + 0"
Argument "iNff" isn't numeric in addition (+) at -e line 1.
1.#INF
#########################
However, perls (such as Strawberry Perl) built using the mingw64.sf.net
compilers don't get it quite right. They seem to recognize the strings
as being numeric, but then numify them to zero:
#########################
C:\>perl -wle "print 'nan' + 0"
0
C:\>perl -wle "print 'InF' + 0"
0
C:\>perl -wle "print 'NanN' + 0"
Argument "NanN" isn't numeric in addition (+) at -e line 1.
0
C:\>perl -wle "print 'iNff' + 0"
Argument "iNff" isn't numeric in addition (+) at -e line 1.
0
#########################
Is this something that the mingw64.sf.net compilers need to address ?
I'm really not too sure where the goalposts stand in relation to this.
I personally preferred it when strings like 'nan' and 'inf' were
treated by Windows perls as being non-numeric, and numified to zero -
at least, then, I knew where things stood.
Cheers,
Rob