aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-08 05:38:16 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-08 05:38:16 +0000
commit161eb30a50ab35b735f483be70cc860855198492 (patch)
tree74bf6060e977555488ef2dac36ddd80990ec25cc /numeric.c
parent6051cd0384c718ba436c75d5663d95cb3b0d19e0 (diff)
downloadruby-161eb30a50ab35b735f483be70cc860855198492.tar.gz
numeric.c: round as double
* numeric.c (flo_round): compare as double, not long double with i387. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/numeric.c b/numeric.c
index b806ceca3c..af57ccdfc7 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2007,10 +2007,10 @@ flo_round(int argc, VALUE *argv, VALUE num)
f = pow(10, ndigits);
x = round(number * f);
if (x > 0) {
- if ((x + 0.5) / f <= number) x += 1;
+ if ((double)((x + 0.5) / f) <= number) x += 1;
}
else {
- if ((x - 0.5) / f >= number) x -= 1;
+ if ((double)((x - 0.5) / f) >= number) x -= 1;
}
return DBL2NUM(x / f);
}