aks@hub.ucsb.edu (Alan Stebbens) (08/08/90)
Larry,
This looks like a bug to me (Perl 3.0p18):
DB<2> p 0x80000000 & 0xF0000000
2147483648
This value, on my handy hex calculator, is equivalent to 0x80000000.
Then why does the following comparison fail?
DB<4> p (0x80000000 & 0xF0000000) == 0x80000000
0
But, look, the comparison works with non-computational values:
DB<5> p 0x80000000 == 0x80000000
1
And look at this:
DB<6> p 0x80000000|0
2147483648
DB<7> p (0x80000000|0) == 0x80000000
0
Of course, if the sign-bit isn't set, the comparisons work fine:
DB<8> p (0x08000000 & 0x0F000000) == 0x08000000
1
Is this Perl's fault, or the result of my DECstation 3100? Well, to
find this out, I checked it out on my SPARCstation; here's the results:
1. The comparison still fails, but
2. The printf "%x" shows the correct value
There is a difference, then, with the printf library routines linked
with Perl on both systems. I think Perl should have its own version
(optionally, at least, like malloc) of the printf routines, rather than
rely on the system version, which, as it has turned out can be broken.
The comparisons still fail, though.
What do you think, is it a bug, or is it a feature?
Alan