1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* numeric.c (flodivmod): floating point division should raise

ZeroDivisionError as integer division. [incompatible]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-11-27 16:01:54 +00:00
parent ce5063c283
commit 90add5db45
3 changed files with 7 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Fri Nov 28 00:12:00 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* numeric.c (flodivmod): floating point division should raise
ZeroDivisionError as integer division. [incompatible]
Thu Nov 27 23:54:37 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (gc_mark): still needs to check stack depth during GC.

View file

@ -678,6 +678,7 @@ flodivmod(double x, double y, double *divp, double *modp)
{
double div, mod;
if (y == 0.0) rb_num_zerodiv();
#ifdef HAVE_FMOD
mod = fmod(x, y);
#else

View file

@ -172,9 +172,7 @@ class TestFloat < Test::Unit::TestCase
assert_raise(TypeError) { 2.0.divmod(nil) }
inf = 1.0 / 0.0
a, b = inf.divmod(0)
assert(a.infinite?)
assert(b.nan?)
assert_raise(ZeroDivisionError) {inf.divmod(0)}
a, b = (2.0**32).divmod(1.0)
assert_equal(2**32, a)