numeric.c: fix return value on big 0
* numeric.c (num_zero_p): should return true if zero. rb_bigzero_p returns 1 or 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
22e41718a4
commit
cbfe54c560
@ -721,7 +721,10 @@ num_zero_p(VALUE num)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (RB_TYPE_P(num, T_BIGNUM)) {
|
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))) {
|
else if (rb_equal(num, INT2FIX(0))) {
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
|
@ -10,5 +10,11 @@ class TestBignum < Test::Unit::TestCase
|
|||||||
assert_equal(0, Bug::Bignum.zero(i), "#{bug8204} Bignum.zero(#{i})")
|
assert_equal(0, Bug::Bignum.zero(i), "#{bug8204} Bignum.zero(#{i})")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_zero?
|
||||||
|
(0..10).each do |i|
|
||||||
|
assert_equal(true, Bug::Bignum.zero(i).zero?)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user