develooper Front page | perl.perl5.porters | Postings from July 2008

integer.pm - behaviour v documentation

Thread Next
From:
Sisyphus
Date:
July 14, 2008 22:27
Subject:
integer.pm - behaviour v documentation
Message ID:
A84987F72FF94EC08721DD7DA9E39A46@desktop2
Hi,
According to the integer.pm documentation "the range of operands and results 
is restricted
to that of familiar two's complement integers, i.e., -(2**31) .. (2**31-1) 
on 32-bit
architectures".

Yet I'm getting (on 5.8.8, 5.10.0, and 5.11.0):

--------------------------------
C:\_32>perl -e "use integer;print 2**31"
2147483648
--------------------------------

Doesn't that contradict the documentation ?

I expected that one liner to output -2147483648, since that's the usual 
signed
integer representation of 2 ** 31  on 32-bit architectures.

Iow, I was expecting that the above one liner would be equivalent to:

--------------------------------
C:\_32>perl -e "printf \"%d\", 2 ** 31"
-2147483648
--------------------------------

Cheers,
Rob 


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