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

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

Thread Next
From:
Father Chrysostomos
Date:
September 26, 2014 20:49
Subject:
[perl #122856] Inconsistent string vs number handling for ch(Inf)
Message ID:
rt-4.0.18-10300-1411764571-305.122856-75-0@perl.org
# New Ticket Created by  Father Chrysostomos 
# Please include the string:  [perl #122856]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=122856 >


$ ./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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About