[Ironruby-core] Is the Fixnum size difference a problem?

John Messerly jomes at microsoft.com
Fri Dec 21 16:45:02 EST 2007

Peter Bacon Darwin:

> IronRuby has the same semantics, except that of course what is a
> Bignum for CRuby is not a Bignum for IronRuby.
> In CRuby:
> 0x40000000.div(0.0) => Infinity
> In IronRuby:
> 0x40000000.div(0.0) => raises FloatDomainError
> Now clearly this is a problem with the fundamental implementation of
> Fixnum/Bignum but Rubinius seems to follow suit and I assume JRuby too
> (although I haven't checked).
> What are your thoughts on dealing with this issue?  Should we brush it
> under the carpet and hope that Ruby 2.0 will fix it or what?  Should
> we force IronRuby's Fixnum to be 31 bits?

I think we can keep Fixnums at 32 bits, and fix div to throw. Just tried in JRuby:

irb(main):001:0> 0x4000_0000_0000_0000.class
=> Fixnum
irb(main):002:0> 0x4000_0000.div(0.0)
FloatDomainError: Infinity

They actually have 64bit Fixnums... wow :)

- John

More information about the Ironruby-core mailing list