Why doesn't JRuby recognize BigNums while Ruby does?

If I type this large integer:

puts 9997836544.class.to_s

and compile with ruby ​​1.86, it reports:

BigNum

while JRuby (1.1.4 in Netbeans) unexpectedly reports:

Fixnum

I thought Java had a BigInteger class corresponding to the BigNum class in Ruby. If so, I expected JRuby and ruby ​​to produce the same result.

+3
source share
1 answer

JRuby Error Report Detected :

, JRuby MRI Fixnum Bignum.
...
, MRI 0x3fffffff FixNum 32- .
JRuby 64- : jruby -e 'p (0x7fffffffffffffff + 1).class' --- > Bignum.

, BigNum, .

+2

Source: https://habr.com/ru/post/1703047/


All Articles