summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-22 02:27:53 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-22 02:27:53 +0000
commit30d762795cf3078764102d9921f875116d5d77a9 (patch)
treeb8b3e02e1c11f543c618b41ccc4292b814b95ced /bignum.c
parent033244c1b2b23c3f70a2a7c5cbdef570fdb9220e (diff)
* bignum.c (): refix of r33536. Don't change behavior of Bignum#/.
[ruby-core:40429] [Bug #5490] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/bignum.c b/bignum.c
index 2d61bb37c0..ede52e1613 100644
--- a/bignum.c
+++ b/bignum.c
@@ -2781,14 +2781,13 @@ rb_big_divide(VALUE x, VALUE y, ID op)
case T_FLOAT:
{
- double div, dy = RFLOAT_VALUE(y);
- if (dy == 0.0) rb_num_zerodiv();
- div = rb_big2dbl(x) / dy;
if (op == '/') {
- return DBL2NUM(div);
+ return DBL2NUM(rb_big2dbl(x) / RFLOAT_VALUE(y));
}
else {
- return rb_dbl2big(div);
+ double dy = RFLOAT_VALUE(y);
+ if (dy == 0.0) rb_num_zerodiv();
+ return rb_dbl2big(rb_big2dbl(x) / dy);
}
}