diff --git a/shared/rational/exponent.rb b/shared/rational/exponent.rb index 2145d6bace..30ebf8d9b9 100644 --- a/shared/rational/exponent.rb +++ b/shared/rational/exponent.rb @@ -122,6 +122,24 @@ (Rational(fixnum_max) ** -bignum_value) }.should raise_error(ArgumentError) end + + it "raises an ArgumentError when self is < -1" do + -> { + (Rational(-2) ** bignum_value) + }.should raise_error(ArgumentError) + -> { + (Rational(fixnum_min) ** bignum_value) + }.should raise_error(ArgumentError) + end + + it "raises an ArgumentError when self is < -1 and the exponent is negative" do + -> { + (Rational(-2) ** -bignum_value) + }.should raise_error(ArgumentError) + -> { + (Rational(fixnum_min) ** -bignum_value) + }.should raise_error(ArgumentError) + end end # Fails on linux due to pow() bugs in glibc: http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866 @@ -148,26 +166,6 @@ }.should complain(/warning: in a\*\*b, b may be too big/) end end - - ruby_version_is "3.4" do - it "returns positive Infinity when self < -1" do - -> { - (Rational(-2) ** bignum_value) - }.should raise_error(ArgumentError) - -> { - (Rational(fixnum_min) ** bignum_value) - }.should raise_error(ArgumentError) - end - - it "returns 0.0 when self is < -1 and the exponent is negative" do - -> { - (Rational(-2) ** -bignum_value) - }.should raise_error(ArgumentError) - -> { - (Rational(fixnum_min) ** -bignum_value) - }.should raise_error(ArgumentError) - end - end end end