* numeric.c (fix_pow): returns 1.0 for 0**0.0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-10-26 08:14:14 +00:00
parent 31667e5ffc
commit 69c7312cb3
2 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,6 @@
Fri Oct 26 17:01:34 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
Fri Oct 26 17:14:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* numeric.c (fix_pow): returns 1.0 for 0**0.0.
* numeric.c (fix_pow): returns infinity for 0**-1. [ruby-dev:32084]

View File

@ -2361,6 +2361,7 @@ fix_pow(VALUE x, VALUE y)
x = rb_int2big(FIX2LONG(x));
return rb_big_pow(x, y);
case T_FLOAT:
if (RFLOAT(y)->value == 0.0) return rb_float_new(1.0);
if (a == 0) {
return rb_float_new(RFLOAT(y)->value < 0 ? (1.0 / zero) : 0.0);
}