develooper Front page | perl.perl6.compiler | Postings from March 2005

Re: int("0x123") == int(0x123) ?

Thread Previous | Thread Next
From:
Larry Wall
Date:
March 15, 2005 10:43
Subject:
Re: int("0x123") == int(0x123) ?
Message ID:
20050315184307.GA24057@wall.org
On Tue, Mar 15, 2005 at 11:09:11PM +0800, Autrijus Tang wrote:
: Currently Pugs numifies hexadecimal and octal strings as if they
: are literals; that means "0x123" and "0o456" all work as expected.
: Is that an acceptable treatment?

It's okay by me.  The restriction on not autoconverting hex and octal
stems from the days when 0777 was assumed to be octal.  Since we've
changed that to 0o777, it's much less likely to autoconvert zip codes
to a different number.  We can allow 0b111 as well.  (Scientific notation
is already allowed in Perl 5 autoconversion.)

: What about "Inf" and "NaN" in numeric context?

We should be intelligent about Inf and NaN, which means Inf is infinity
but Info is 0 (plus warning).  NaN is not a number, while NaNa is 0 (plus
warning).  We also recognize +Inf and -Inf.

Larry

Thread Previous | 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