diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-22 23:28:26 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-22 23:28:26 +0000 |
commit | c6da8470b9f1f317825e55e28ed1ec1201a7ecf7 (patch) | |
tree | e76c939853253e4f2dbba1b9e12193d56a1ca6d2 /test/ruby/test_rational.rb | |
parent | 609e35cd2f45b9113c1da3deb43e177ae1272ab9 (diff) | |
download | ruby-c6da8470b9f1f317825e55e28ed1ec1201a7ecf7.tar.gz |
rational.c: infinity in power
* rational.c (nurat_expt): return Infinity due to overflow.
[ruby-core:79686] [Bug #13242]:
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_rational.rb')
-rw-r--r-- | test/ruby/test_rational.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb index 0a400edea2..c1e7d824d1 100644 --- a/test/ruby/test_rational.rb +++ b/test/ruby/test_rational.rb @@ -955,6 +955,12 @@ class Rational_Test < Test::Unit::TestCase assert_raise(ZeroDivisionError, bug5713) { Rational(0, 1) ** Rational(-2,3) } end + def test_power_overflow + bug = '[ruby-core:79686] [Bug #13242]: Infinity due to overflow' + x = EnvUtil.suppress_warning {4r**40000000} + assert_predicate x, :infinite?, bug + end + def test_positive_p assert_predicate(1/2r, :positive?) assert_not_predicate(-1/2r, :positive?) |