On Fri Jan 05 18:33:35 2007, zefram <!-- x --> at fysh.org wrote: > > This is a bug report for perl from zefram <!-- x --> at fysh.org, > generated with the help of perlbug 1.35 running under perl v5.8.4. > > > ----------------------------------------------------------------- > [Please enter your report here] > > $ perl -lwe 'print "foo" + 0' > Argument "foo" isn't numeric in addition (+) at -e line 1. > 0 > $ perl -lwe 'print "inf" + 0' > 0 > $ perl -lwe 'print "infinity" + 0' > 0 > $ perl -lwe 'print "nan" + 0' > 0 > $ > > The strings "inf", "infinity", and "nan" undergo numeric conversion > to the value zero, just like all other alphabetic strings. Unlike > other alphabetic strings, they don't elicit a warning when doing so. > They should. There are some other strings with the same broken > behaviour. > > Presumably the intent of this exception is that these strings could > represent not-a-number and infinite floating-point values. However, > they're not actually doing so. 0 + NaN should yield NaN, and 0 + > infinity should yield infinity. The correct floating point behaviour > can be observed with Perl: > > $ perl -lwe 'print 1e1000' > inf > $ perl -lwe 'print 1e1000 + 0' > inf > $ perl -lwe 'print 1e1000/1e1000' > nan > $ perl -lwe 'print 1e1000/1e1000 + 0' > nan > > Thus a true floating-point infinity stringifies as "inf", and a true > NaN as "nan". > These seem to be working for me with 5.8.8 and bleadperl, but I should check for some tests for this before closing this bug.Thread Next