Hello all,

Just making a quick note of a bug we found in Bignum.to_s in Ruby 1.8.6,
in case it burns anyone else.

Examples:

irb(main):001:0> 18446744073709551615.to_s(36)  # should be
"3w5e11264sgsf"
=> "w5e11264sgsf"
irb(main):002:0> -18446744073709551615.to_s(8)  # should be
"-1777777777777777777777"
=> "11777777777777777777777"

The bug affects bases 8, 9, and 32-36 inclusive, over certain ranges of
values depending on the base. Values immediately less than 2**64 seem to
be particularly affected. For example, in base 36, all values from
4738381338321616896 through 18446744073709551615 (which is 2**64-1) will
fail.

It manifests only in Ruby 1.8.6. Ruby 1.8.5 works correctly. (It appears
that some optimization work went a little too far.)

For anyone affected by this, I filed the bug on RubyForge, and posted a
possible "works for me, but use at your own risk" fix to bignum.c:

http://rubyforge.org/tracker/?func=detail&aid=9410&group_id=426&atid=1698

Cheers,
Daniel Azuma
Chief Architect, Zoodango.com

-- 
Posted via http://www.ruby-forum.com/.