From: Makoto Inada Date: 2007-04-14T02:32:47+09:00 Subject: Re: Question about Fixnum ------=_Part_18571_18641997.1176485564731 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Because a bit is used to differentiate fixnums from other value types appearing in the same context, such as object pointers. A regular Ruby object has its own memory space which Ruby interpreter has access via a pointer. Allocating memory for each number is obviously too expensive, so Matz decided to store "small" numbers in a pointer itself. This is Fixnum. This means you have to distinguish a fixnum from a pointer somehow. The bit I mentioned is used for the purpose. LSB of a fixnum is set to 1 because an object pointer's LSB is guaranteed to be 0 on a 32bit/64bit system. -Mak On 4/13/07, huang zhimin wrote: > > On 4/14/07, huang zhimin < flyerhzm@gmail.com> wrote: > > > > Why the range of Fixnum is -2^30 ~ 2^30 rather than -2^31 ~2^31 ? > > ~~~~should be > 2^30-1 ~~~~2^31-1 > > > -- > > flyerhzm@hotmail.com > > > > > -- > flyerhzm@hotmail.com > ------=_Part_18571_18641997.1176485564731--