[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] When integers go bad



I like Ruby's solution, which is that integers get promoted to BigNums
transparently as needed:

irb(main):010:0> a = 1000000000
=> 1000000000
irb(main):013:0> a.class
=> Fixnum
irb(main):011:0> b = 1000
=> 1000
irb(main):014:0> b.class
=> Fixnum
irb(main):015:0> c = a * b
=> 1000000000000
irb(main):016:0> c.class
=> Bignum
irb(main):017:0> c * c
=> 1000000000000000000000000

I have no idea how hard this would be to implement, or what the
performance implications would be. But it's nifty.

-- 
Tim Walters | http://doubtfulpalace.com