diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-10-26 08:14:14 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-10-26 08:14:14 +0000 |
commit | 93f00244c51d48b6c18048d7ab4224eb01c8cb36 (patch) | |
tree | f275ea4a7becae787053a6ab696a608a720980a8 /numeric.c | |
parent | 92d83c93546547a5d43cdf3afdc4ec09ef086475 (diff) |
* numeric.c (fix_pow): returns 1.0 for 0**0.0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -2247,12 +2247,10 @@ fix_pow(x, y) long a = FIX2LONG(x); if (FIXNUM_P(y)) { - long b; + long b = FIX2LONG(y); - b = FIX2LONG(y); if (b == 0) return INT2FIX(1); if (b == 1) return x; - a = FIX2LONG(x); if (a == 0) { if (b > 0) return INT2FIX(0); return rb_float_new(1.0 / zero); @@ -2280,6 +2278,7 @@ fix_pow(x, 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); } |