From: "Shot (Piotr Szotkowski)" Date: 2009-12-22T01:34:01+09:00 Subject: Re: Ruby's implementation of Fixnum-assignment --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable RichardOnRails: > 1. Integer's in the range -2**30 to 2**30-1 are > Fixnum's. Integers outside that range are Bignum's Depending on the architecture: >> (2**62-1).class =3D> Fixnum >> (2**62).class =3D> Bignum >> RUBY_DESCRIPTION =3D> "ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]" > 2. For Fixnum "i", i's object_id is twice i's value plus 1. Said > another way, i's object_id is i's binary value left-shifted with > 1 as padding. Right, Fixnums are immediate in Ruby (at least in MRI). > 3. Object_id's of Bignum's close to the boundaries of Fixnum's > bear no apparent relationship to the Fixnum object_id's. Right, because Bignums are =E2=80=98regular=E2=80=99 objects. > For Fixnums, the object_id IS the value, just a little shifted. Spot on. There was a very nice talk about these things; you might want to google for "Understanding Ruby's Object Model" (the top links do not open for me at the moment, so I=E2=80=99m not sure this is the talk I think of). =E2=80=94 Shot --=20 Clinical psychology seems designed for people too smart for religion but not smart enough for science. [Paul Lutus, Asperger=E2=80=99s by Proxy] --Dxnq1zWXvFF0Q93v Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksvo0oACgkQi/mCfdEo8UrrkwCgnltP/i0ampROAz0MPOqavUQX JFkAnjF9ah9OfIzXHrVFcXwfh6b020X8 =MBl+ -----END PGP SIGNATURE----- --Dxnq1zWXvFF0Q93v--