summaryrefslogtreecommitdiff
path: root/numpy/core/src/scalarmathmodule.c.src
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2007-05-17 10:13:39 +0000
committerTravis Oliphant <oliphant@enthought.com>2007-05-17 10:13:39 +0000
commit5b4e40b73703617f8d24c6b4162f6777eaa176a1 (patch)
tree211c906fad7b5089be5ecaf9a13655eb8fb031f5 /numpy/core/src/scalarmathmodule.c.src
parentfadee7a84dbbee56f364bf7140e3752a28d1617b (diff)
downloadnumpy-5b4e40b73703617f8d24c6b4162f6777eaa176a1.tar.gz
Propagate changes made to umathmodule.c to fix the problem with division and remainder not being consistent for negative numbers.
Diffstat (limited to 'numpy/core/src/scalarmathmodule.c.src')
-rw-r--r--numpy/core/src/scalarmathmodule.c.src7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/core/src/scalarmathmodule.c.src b/numpy/core/src/scalarmathmodule.c.src
index 0ab062e92..00f7c6ed6 100644
--- a/numpy/core/src/scalarmathmodule.c.src
+++ b/numpy/core/src/scalarmathmodule.c.src
@@ -218,7 +218,14 @@ static void
}
#endif
else {
+#if @neg@
+ @name@ tmp;
+ tmp = a / b;
+ if (((a > 0) != (b > 0)) && (a % b != 0)) tmp--;
+ *out = tmp;
+#else
*out = a / b;
+#endif
}
}
#define @name@_ctype_floor_divide @name@_ctype_divide