New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitwise math for 54+-bit numbers is broken #9792
Comments
From beeman@alumni.utexas.netThis is a bug report for perl from beeman@alumni.utexas.net, A curious bug when doing bitwise math on a 64-bit linux version of perl. I've seen this with 5.8.5, 5.8.7, and 5.10.0. I'll let the debugger illustrate the problem: DB<9> $foo = 2**53 DB<10> printf("0x%x", $foo) Looks good, as it seems to for all smaller numbers. But when we move up to 54-bit: DB<1> $foo = 2**54 DB<2> printf("0x%x", $foo) Some very strange results. Similar problems with larger numbers: DB<<31>> $foo = 2**56 DB<<32>> printf("0x%x",$foo-1) Flags: Site configuration information for perl v5.8.5: Configured by tmnguye3 at Mon Nov 1 16:32:56 PST 2004. Summary of my perl5 (revision 5 version 8 subversion 5) configuration: Locally applied patches: @INC for perl v5.8.5: Environment for perl v5.8.5: |
From zefram@fysh.orgbeeman@alumni.utexas.net (via RT) wrote:
This is floating-point arithmetic. You have IEEE double-precision You get floating-point arithmetic because of the **, which is always Another way to influence this behaviour, which might constitute a Getting back to the original problem, the use of floating point for the # Arithmetic operators I've noticed some other places that fail to live up to this description, -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @khwilliamsonbeeman@alumni.utexas.net (via RT) wrote:
I tried this on 5.10 on an x86 running Ubuntu, and it did not fail |
From beeman@alumni.utexas.netStrange. I just tried it on another 5.10.0 build, using On Sun, Jul 12, 2009 at 8:54 PM, Karl Williamson <public@khwilliamson.com>wrote:
|
From @ysthOn Sun, July 12, 2009 11:09 pm, Beeman Strong wrote:
I think Karl must have used a 32bitint perl. A 64bitint (amd64 ubuntu) perl 5.10 does fail. Exponentiation doesn't preserve integer representation currently (except in $ perl -we'printf "%x\n", 2**54-1' |
Migrated from rt.perl.org#67432 (status was 'open')
Searchable as RT67432$
The text was updated successfully, but these errors were encountered: