diff --git a/numeric.c b/numeric.c index 21e8eeeb8e..9a9b8d0b44 100644 --- a/numeric.c +++ b/numeric.c @@ -721,7 +721,10 @@ num_zero_p(VALUE num) } } else if (RB_TYPE_P(num, T_BIGNUM)) { - return rb_bigzero_p(num); + if (rb_bigzero_p(num)) { + /* this should not happen usually */ + return Qtrue; + } } else if (rb_equal(num, INT2FIX(0))) { return Qtrue; diff --git a/test/-ext-/bignum/test_bigzero.rb b/test/-ext-/bignum/test_bigzero.rb index 8529e54456..43a99b01a3 100644 --- a/test/-ext-/bignum/test_bigzero.rb +++ b/test/-ext-/bignum/test_bigzero.rb @@ -10,5 +10,11 @@ class TestBignum < Test::Unit::TestCase assert_equal(0, Bug::Bignum.zero(i), "#{bug8204} Bignum.zero(#{i})") end end + + def test_zero? + (0..10).each do |i| + assert_equal(true, Bug::Bignum.zero(i).zero?) + end + end end end