mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Suppress too big exponent warnings
This commit is contained in:
parent
228ad7d84b
commit
64d79d333b
1 changed files with 15 additions and 5 deletions
|
@ -105,14 +105,24 @@ describe :rational_exponent, shared: true do
|
|||
# Fails on linux due to pow() bugs in glibc: http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
|
||||
platform_is_not :linux do
|
||||
it "returns positive Infinity when self < -1" do
|
||||
(Rational(-2) ** bignum_value).infinite?.should == 1
|
||||
(Rational(-2) ** (bignum_value + 1)).infinite?.should == 1
|
||||
(Rational(fixnum_min) ** bignum_value).infinite?.should == 1
|
||||
-> {
|
||||
(Rational(-2) ** bignum_value).infinite?.should == 1
|
||||
}.should complain(/warning: in a\*\*b, b may be too big/)
|
||||
-> {
|
||||
(Rational(-2) ** (bignum_value + 1)).infinite?.should == 1
|
||||
}.should complain(/warning: in a\*\*b, b may be too big/)
|
||||
-> {
|
||||
(Rational(fixnum_min) ** bignum_value).infinite?.should == 1
|
||||
}.should complain(/warning: in a\*\*b, b may be too big/)
|
||||
end
|
||||
|
||||
it "returns 0.0 when self is < -1 and the exponent is negative" do
|
||||
(Rational(-2) ** -bignum_value).should eql(0.0)
|
||||
(Rational(fixnum_min) ** -bignum_value).should eql(0.0)
|
||||
-> {
|
||||
(Rational(-2) ** -bignum_value).should eql(0.0)
|
||||
}.should complain(/warning: in a\*\*b, b may be too big/)
|
||||
-> {
|
||||
(Rational(fixnum_min) ** -bignum_value).should eql(0.0)
|
||||
}.should complain(/warning: in a\*\*b, b may be too big/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue