From: "nobu (Nobuyoshi Nakada)" Date: 2013-04-16T12:18:25+09:00 Subject: [ruby-core:54312] [ruby-trunk - Bug #8204] ObjectSpace.each_object(Bignum) can generate Bignums that are to small to be Bignums Issue #8204 has been updated by nobu (Nobuyoshi Nakada). > x = (1 << 100).coerce(42).first # => 42 > x.class # => Bignum It's a Feature. Numeric#coerce must return a pair of converted interoperable values. In future version, Fixnum and Bignum might be merged. However, these commits do not intend it. Just fixes the comparison, and hides and frees intermediate objects earlier. ---------------------------------------- Bug #8204: ObjectSpace.each_object(Bignum) can generate Bignums that are to small to be Bignums https://bugs.ruby-lang.org/issues/8204#change-38593 Author: Hanmac (Hans Mackowiak) Status: Closed Priority: Normal Assignee: ko1 (Koichi Sasada) Category: core Target version: current: 2.1.0 ruby -v: ruby 2.1.0dev (2013-04-02 trunk 40068) [x86_64-linux] when i do: p ObjectSpace.each_object(Bignum).to_a => [18446744073709551615, 3, 2394213621560389257607583714845333205] and again: ObjectSpace.each_object(Bignum).to_a => [18446744073709551615, 3, 63326588221939058800767348888534802301, 0, 0, 0] my question: why does the 3 and the zeros show up? n = ObjectSpace.each_object(Bignum).min #=> 0 p n.class #Bignum p n.zero? #=> false p n < 0 # true okay this means i have a zero, that looks like zero, but is not a zero and its class is Bignum (but when i try in a new ruby session) (2**64) < 0; p bigZero = ObjectSpace.each_object(Bignum).min #=> 0 p bigZero.class #Bignum p bigZero.zero? #=> true okay, this time i get a zero that looks like a zero, and react like a zero, but its still a Bignum so where does the zeros come from and why does they react so totaly different? -- http://bugs.ruby-lang.org/