diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-17 12:55:16 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-17 12:55:16 +0000 |
commit | b6849b2502e7f9ea93e5c1dc6a27359a6311f140 (patch) | |
tree | b8de0496c999e2cb6eb3181204dd740cbfb3d515 /numeric.c | |
parent | bbd2b5e9bd62c708a0ea026706528a114e6d5f5a (diff) | |
download | ruby-b6849b2502e7f9ea93e5c1dc6a27359a6311f140.tar.gz |
* bignum.c (rb_big_fdiv): checks whether the given second argument
can be converted to float properly.
* numeric.c (fix_fdiv): calls rb_big_fdiv when the given second
argument is a bignum.
* rational.c (nurat_fdiv): should calculate Float(x/y), not
Float(x)/Float(y).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -2269,6 +2269,8 @@ fixdivmod(long x, long y, long *divp, long *modp) * */ +VALUE rb_big_fdiv(VALUE x, VALUE y); + static VALUE fix_fdiv(VALUE x, VALUE y) { @@ -2277,7 +2279,7 @@ fix_fdiv(VALUE x, VALUE y) } switch (TYPE(y)) { case T_BIGNUM: - return DBL2NUM((double)FIX2LONG(x) / rb_big2dbl(y)); + return rb_big_fdiv(rb_int2big(FIX2LONG(x)), y); case T_FLOAT: return DBL2NUM((double)FIX2LONG(x) / RFLOAT_VALUE(y)); default: |