From: Dirkjan Bussink Date: 2008-03-09T21:26:05+09:00 Subject: Bug in Fixnum#& with respect to coercion into a bignum Hello all, During some testing with IPv6 stuff, I've found a bug in the handling of object given to Fixnum#& that is coerced into a Bignum. The following code shows the problem: class BignumMock def to_int 2 ** 64 end end mock = BignumMock.new puts 3 & 2 ** 64 puts 3 & mock.to_int puts 3 & mock The last line fails, but what I would expect is that it the object is coerced correctly. The cause of this is that in fix_and in numeric.c, only a direct Bignum is checked. If y in fix_and is not a Fixnum or Bignum, it should be coerced first and then the result should be checked for the Bignum type. This would easily fix this bug. The same problem also applies to fix_or and fix_xor of course. -- Regards, Dirkjan Bussink