diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-10-27 07:10:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-10-27 07:10:53 +0000 |
commit | 723038b0ba1a6fac881ceacdfc0ff01375eedc10 (patch) | |
tree | 96788d9c79abd5583b6352506ffc26fb78124cdf /bignum.c | |
parent | e344d8a48388a213e4dd404b128769c5dccbf11a (diff) | |
download | ruby-723038b0ba1a6fac881ceacdfc0ff01375eedc10.tar.gz |
* 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.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); } |