aboutsummaryrefslogtreecommitdiffstats
path: root/enum.c
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-23 12:50:24 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-23 12:50:24 +0000
commita06790381b938e5e8b29e500ac4f455b103c4783 (patch)
tree89a83bc4c1c0a7895f8683151acd40cfa615f49c /enum.c
parentca21c0a6ac6f49d0435d5817434d500ab422dbf7 (diff)
downloadruby-a06790381b938e5e8b29e500ac4f455b103c4783.tar.gz
* enum.c (ary_inject_op): put subtract operation out of if-clause.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/enum.c b/enum.c
index e6ca6ab0fc..23e4f5a5e4 100644
--- a/enum.c
+++ b/enum.c
@@ -688,17 +688,18 @@ ary_inject_op(VALUE ary, VALUE init, VALUE op)
sum_float:
c = 0.0;
while (1) {
- double y, t;
+ double x, y, t;
e = RARRAY_AREF(ary, i);
if (RB_FLOAT_TYPE_P(e))
- y = RFLOAT_VALUE(e) - c;
+ x = RFLOAT_VALUE(e);
else if (FIXNUM_P(e))
- y = FIX2LONG(e) - c;
+ x = FIX2LONG(e);
else if (RB_TYPE_P(e, T_BIGNUM))
- y = rb_big2dbl(e) - c;
+ x = rb_big2dbl(e);
else
break;
+ y = x - c;
t = f + y;
c = (t - f) - y;
f = t;