Resolution: Won't Fix
Affects Version/s: JRuby 1.x+
Fix Version/s: None
Component/s: Core Classes/Modules
Environment:Ubunty Linux 7.10 x32,
ruby 1.8.5 (2007-11-20 rev 4842) [i386-jruby1.1b1]
Number of attachments :
Hmm, this is a tricky one. It seems that JRuby and MRI have different limits to separate Fixnum and Bignum.
And from the official ruby docs: "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.".
So, MRI uses 0x3fffffff as the biggest FixNum under 32bit environment.
And JRuby always uses 64bit value: jruby -e 'p (0x7fffffffffffffff + 1).class' ---> Bignum.
The differences are easy to see:
1. ruby -e 'p (0x3fffffff + 1).class' ---> Bignum
2. jruby -e 'p (0x3fffffff + 1).class' ---> Fixnum
Also, this is a root cause for one test failure from rubinius specs:
(basically, division by 0.0 behaves differently in case of FixNum or BigNum).
Note: there is also a separate issue in the rubinius spec test, since the
0x3fffffff + 1 value is hardcoded there, which is not correct for 64bit systems, based on the official spec quoted above.
#>bin/mspec -t jruby spec/core/bignum
Bignum#div does NOT raise ZeroDivisionError if other is zero and is a Float FAILED