From: Shashank Date Date: 2003-05-28T12:33:34+09:00 Subject: Re: Help! I don't want a bignum... "Andrew Walrond" wrote in message > > However, ruby kindly converts the last number, 1126301404 (0x4321fedc in > hex which fits nicely in a long) to a Bignum, but syscall only accepts a > Fixnum > > Any idea how to get around this??? > I don't know, because on my (32-bit?) Win XP Pro: ------------------------------------------------ C:\>ruby -ve "puts((2**31).class)" ruby 1.6.8 (2002-12-24) [i586-mswin32] Bignum C:\>ruby -e "puts((2**30).class)" Bignum C:\>ruby -e "puts((2**30 - 1).class)" Fixnum C:\>ruby -e "puts(2**30 - 1)" 1073741823 C:\>ri Fixnum ------------------------------------------------------------------------ class: Fixnum < Integer ------------------------------------------------------------------------ A Fixnum holds Integer values that can be represented in a native machine word (minus 1 bit). If any operation on a Fixnum exceeds this range, the value is automatically converted to a Bignum. Fixnum objects have immediate value. This means that when they are assigned or passed as parameters, the actual object is passed, rather than a reference to that object. Assignment does not alias Fixnum objects. There is effectively only one Fixnum object instance for any given integer value, so, for example, you cannot add a singleton method to a Fixnum. ------------------------------------------------------------------------ <=>, Arithmeticoperations, Bitoperations, [], abs, div, divmod, id2name, modulo, quo, size, to_f, to_s, to_sym, zero? ------------------------------------------------------------------------ What gives ? -- shanko