summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--numeric.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 08f19f5472..7898bb81d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Mar 14 17:55:29 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (flodivmod): must through the same pass if HAVE_FMOD or not.
+ this is a bugfix of r35013.
+
Wed Mar 14 16:41:55 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* test/test_tmpdir.rb (TestTmpdir#test_world_writable): skip on Windows.
diff --git a/numeric.c b/numeric.c
index 5eff5ad547..49bfbbaf01 100644
--- a/numeric.c
+++ b/numeric.c
@@ -814,18 +814,18 @@ 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
if((x == 0.0) || (isinf(y) && !isinf(x)))
mod = x;
else {
+#ifdef HAVE_FMOD
+ mod = fmod(x, y);
+#else
double z;
modf(x/y, &z);
mod = x - z * y;
- }
#endif
+ }
if (isinf(x) && !isinf(y) && !isnan(y))
div = x;
else