merge revision(s) 57688,57689: [Backport #13242]

rational.c: infinity in power

	* rational.c (nurat_expt): return Infinity due to overflow.
	  [ruby-core:79686] [Bug #13242]:
	rational.c: infinity in power

	* rational.c (nurat_expt): return 0 due to overflow.
	  [ruby-core:79686] [Bug #13242]:

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2017-03-25 18:16:16 +00:00
parent d410184643
commit f84d286415
4 changed files with 13 additions and 1 deletions

View file

@ -3158,6 +3158,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;
}