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 /numeric.c | |
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 'numeric.c')
-rw-r--r-- | numeric.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -3913,6 +3913,8 @@ int_pow(long x, unsigned long y) VALUE v; bignum: v = rb_big_pow(rb_int2big(x), LONG2NUM(y)); + if (RB_FLOAT_TYPE_P(v)) /* infinity due to overflow */ + return v; if (z != 1) v = rb_big_mul(rb_int2big(neg ? -z : z), v); return v; } |