The problem occurs in large integers, where the lower 8 bits get rounded if the upper 8 are in use. Here's a simple test script that illustrates the problem.
#!/path/to/perl my $X = \$X; printf STDOUT "Starting with VAR %lx and REF %lx \n", $X, \$X; if ($X == \$X) { printf STDOUT "uh oh, they are deemed equal\n"; } else { printf STDOUT "ah, good, they are observed to differ\n"; } # end
Here's a slightly more informative version of the same:
#!/path/to/perl my $X = \$X; my $Y = \$Y; if ( \$X == \$Y ) { printf STDOUT "disturbing declaration of equality! \n"; printf STDOUT "Refs: %s \t %s \n", \$X, \$Y; printf STDOUT "Vals: %lx \t %lx \n", $X, $Y; printf STDOUT "SOps: sum %lx \t dif %lx \n", $X + $Y, $X - $Y; printf STDOUT "incs: %lx \t +512=%lx \t +1024=%lx \n", $X, $X ++ 512, $X + 1024; } else { printf STDOUT "all is quiet and peaceful, \n"; printf STDOUT "%lx and %lx are recognized to differ by %lx \n" +, \$X, \$Y, \$X - \$Y; } # end
Results on the Solaris 5.8 machine:
all is quiet and peaceful, 100231cc0 and 100231ce0 are recognized to differ by ffffffffffffffe0
Results on the HPUX 11 machine:
disturbing declaration of equality! Refs: SCALAR(0x800000010002a9b0) SCALAR(0x800000010002a9d0) Vals: 800000010002a9f0 800000010002aa30 SOps: sum 200055000 dif 0 incs: 800000010002a9f0 +512=800000010002a800 +1024=800000010002b00 +0
What seems to be happening in the second case is values like
800000010002a9f0 and 800000010002aa30
are getting rounded to
800000010002a800 and 800000010002a800
and treated as equal, among other unsettling traits.
So, has anyone else encountered this? Is there a quick and happy fix? Is libc.sl hopelessly mangled? Can't we all just...get along?
In reply to 64-to-56-bit truncation? by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |