summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-27 07:10:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-27 07:10:53 +0000
commit723038b0ba1a6fac881ceacdfc0ff01375eedc10 (patch)
tree96788d9c79abd5583b6352506ffc26fb78124cdf /bignum.c
parente344d8a48388a213e4dd404b128769c5dccbf11a (diff)
* bignum.c (rb_big_divide): raise ZeroDivisionError if divisor is
zero, as well as Fixnum. [ruby-core:40429] [Bug #5490] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bignum.c b/bignum.c
index a618caeb37..db7215ac15 100644
--- a/bignum.c
+++ b/bignum.c
@@ -2774,7 +2774,9 @@ rb_big_divide(VALUE x, VALUE y, ID op)
case T_FLOAT:
{
- double div = rb_big2dbl(x) / RFLOAT_VALUE(y);
+ double div, dy = RFLOAT_VALUE(y);
+ if (dy == 0.0) rb_num_zerodiv();
+ div = rb_big2dbl(x) / dy;
if (op == '/') {
return DBL2NUM(div);
}