From: Mr Magpie Date: 2007-04-30T14:15:41+09:00 Subject: Re: Why is 0x7FFFFFFF Bignum and not Fixnum ? unknown wrote: > In message , 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. Oh, right! > > 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. > Oh really, thats kinda sad - the abstractions are getting in the way... -- Posted via http://www.ruby-forum.com/.