develooper Front page | perl.perl5.porters | Postings from June 2004

infinity changes from 5.6.1 to 5.8.3

Thread Next
Eric Wilhelm
June 21, 2004 13:52
infinity changes from 5.6.1 to 5.8.3
Message ID:

I'm having trouble finding any documentation for this change, so I'm not sure 
if it is a bug or not.  In the perl58delta.pod, it says "Infinity is now 
recognized as a number".

I'm not sure that I ever found this functionality documented with 5.6.1, so 
possibly I wasn't supposed to use it.


sort()ing +/- infinity:
  perl -e 'print join(" ", sort({$a <=> $b} 0, 1, inf, -inf)), "\n";'

5.6.1:  -inf 0 1 inf
5.8.3:  0 inf -inf 1

The 5.8.3 behavior here can be fixed by using the 'use bigint' pragma, but not 
when 'inf' is a text string (such as when read from @ARGV below), where in 
5.6.1, the string 'inf' and '-inf' automagically turned into infinity.

sprintf/printf behavior changes:
  perl -e '
    print join(" ", map({sprintf("%0.2f", $_)} @ARGV)), "\n";
    ' inf 1  2.334 -inf

5.6.1:  inf 1.00 2.33 -inf
5.8.3:  0.00 1.00 2.33 -0.00

The 5.6.1 here is the one shipped with RedHat7.3, while the 5.8.3 is on Debian 
'sarge'.  I've tried compiling 5.8.2, and 5.9.0 from source, and apparently 
they behave just like this 5.8.3 (unless I'm missing something in the 

I'd really like to have the 5.6.1 behavior here.  Is there some way to build 
the interpreter that I'm missing, or is this a bug?

A counterintuitive sansevieria trifasciata was once literalized guiltily.
                                        --Product of Artificial Intelligence

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About