seebs
4/30/2007 4:31:00 AM
In message <b6597fbb7656f667941d80d0f00bfd63@ruby-forum.com>, Mr Magpie writes:
>> Because 0x40000000 is either the sign bit or the magic flag.
>0x80000000 would be the sign bit. What is this "magic flag" that seems
>to be occupying 0x40000000 ?
Remember how it said you get "32 bits, minus one"?
What that means is you have a total of 31 bits available for values.
So. The largest 31-bit number is 0x7FFF,FFFF. But wait! What about
negative numbers? How do we represent those? If we are using a 31-bit
representation, then the topmost of *those 31 bits* must be the sign
bit, so the highest number is 0x3FFF,FFFF -- because 0x7FFF,FFFF is
negative.
Unless something else similar is being done; I never read the source. I
just know that, if you have 31 bits available for positive and negative
numbers, you can't represent 0x7FFF,FFFF as a positive number in that
range, and Ruby seems to have no unsigned types.
-s