summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-29 14:22:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-29 14:22:49 +0000
commit7c99a7df8587d1b0683fb216dc3704d66332c957 (patch)
tree6d4d1678457db65b9dd20a89e9da0e30d30b9c53
parent2ceceb8f3e78f364bd2b2e40c84f7aa6c0ecd228 (diff)
* numeric.c (flo_round): use absolute value as divisor.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--numeric.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 45ae085de9..2da88a405a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun May 29 23:22:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (flo_round): use absolute value as divisor.
+
Sun May 29 23:17:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
* re.c (rb_reg_match): fix rdoc of Regexp#=~.
diff --git a/numeric.c b/numeric.c
index 09860dc6f2..b868c51bea 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1512,7 +1512,7 @@ flo_round(int argc, VALUE *argv, VALUE num)
VALUE f10 = int_pow(10, -ndigits);
VALUE n10 = f10;
if (number < 0) {
- f10 = FIXNUM_P(f10) ? fix_uminus(f10) : rb_big_uminus(f10);
+ n10 = FIXNUM_P(n10) ? fix_uminus(n10) : rb_big_uminus(n10);
}
num = rb_big_idiv(rb_dbl2big(absnum), n10);
return FIXNUM_P(num) ? fix_mul(num, f10) : rb_big_mul(num, f10);