develooper Front page | perl.perl5.porters | Postings from September 2014

[perl #122856] Inconsistent string vs number handling for ch(Inf)

Thread Next
Father Chrysostomos
September 26, 2014 20:49
[perl #122856] Inconsistent string vs number handling for ch(Inf)
Message ID:
# New Ticket Created by  Father Chrysostomos 
# Please include the string:  [perl #122856]
# in the subject line of all future correspondence about this issue. 
# <URL: >

$ ./perl -we '()=chr "Inf"'
$ ./perl -we '()=chr 0+Inf'
Cannot chr Inf at -e line 1.

"Inf" and 0+Inf have the same numeric and string representations, so chr should treat them the same way.  Either we should revert to treating inf as 0 (or 0xff, whichever), or make chr("Inf") die, too.

pack has a similar bug:

$ ./perl -we '()=pack "l", "Inf"'
$ ./perl -we '()=pack "l", 0+"Inf"'
Cannot pack Inf with 'l' at -e line 1.


Father Chrysostomos

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