From: "Ara.T.Howard" Date: 2005-07-28T06:12:28+09:00 Subject: Re: Fixnum::{MIN,MAX} --8323328-1747698051-1122498746=:4734 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1747698051-1122498746=:4734" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1747698051-1122498746=:4734 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 28 Jul 2005, Nikolai Weibull wrote: > This may be silly, considering that Fixnums are converted to Bignums if > necessary, but is there no room for having MIN and MAX constants for > Fixnums? This is my C talking, but it=E2=80=99s kind of nice to have the= se > kinds of limits for certain algorithms and =E2=80=9Cdefault=E2=80=9D valu= es. Any > input?, > nikolai awesome! i have this everywhere: class Fixnum N_BYTES =3D [42].pack('i').size N_BITS =3D N_BYTES * 8 MAX =3D 2 ** (N_BITS - 2) - 1 MIN =3D -MAX - 1 end cheers. -a --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | My religion is very simple. My religion is kindness. | --Tenzin Gyatso =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D --8323328-1747698051-1122498746=:4734-- --8323328-1747698051-1122498746=:4734--