Shashank Date wrote: > > 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 > > > What gives ? > -- shanko > This is the correct behaviour. The valid range for a fixnum is -(2**30) to (2**30)-1 For instance, if your machine had an 8bit word, then... 8bits considered as unsigned can hold 0 to 255 (0 to (2**8)-1) 8bits considered as signed can hold -128 to 127 (-(2**7) to (2**7)-1) But ruby reserves one of those bits, so we only have 7 to play with, giving a valid range of -(2**6) to (2**6)-1, where 6 is the number of bits in our word minus 2 Now back to our realistic 32bit word; 6 becomes 32-2 = 30 and our valid range is -(2**30) to (2**30) Read up on twos complement if this makes no sense. Hope this helps ;) Andrew Walrond