develooper Front page | perl.perl5.porters | Postings from February 2015

Re: [perl #123851] "use integer" behaving oddly for large unsigned values

Thread Previous | Thread Next
From:
Eric Brine
Date:
February 17, 2015 04:48
Subject:
Re: [perl #123851] "use integer" behaving oddly for large unsigned values
Message ID:
CALJW-qGvJj5=fVcGpLUyZmRihPQrs8yuTYMsjJuMmkMrOoNqpg@mail.gmail.com
bigint says " Integer constants are created as proper BigInts." To me, that
means the following two snippets should be equivalent:

$ perl -Minteger -le '$x = 10_000_000_000_000_000_011; print $x; print $x /
10;'
10000000000000000011
-844674407370955160

$ perl -MMath::BigInt -le '$x =
Math::BigInt->new("10_000_000_000_000_000_011"); print $x; print $x /
Math::BigInt->new("10");'
10000000000000000011
1000000000000000001

So I agree with Sisyphus. Something isn't right.

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