summaryrefslogtreecommitdiff
path: root/numpy/core/src/umathmodule.c.src
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-07-06 21:41:57 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-07-06 21:41:57 +0000
commit3ea289e92d3a53bc296cb6a0a26bcafaee7ca48e (patch)
treededce253c4017984016305811c0578c6475363bb /numpy/core/src/umathmodule.c.src
parent03908e3a396a3612ce5bcc7ccd0bd40e004166ec (diff)
downloadnumpy-3ea289e92d3a53bc296cb6a0a26bcafaee7ca48e.tar.gz
Speed up mod function using fmod and add use_pythonmath and use_scalarmath functions to alter the tables of the appropriate array scalars.
Diffstat (limited to 'numpy/core/src/umathmodule.c.src')
-rw-r--r--numpy/core/src/umathmodule.c.src7
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/core/src/umathmodule.c.src b/numpy/core/src/umathmodule.c.src
index 8d1cd1b87..d5fc5872e 100644
--- a/numpy/core/src/umathmodule.c.src
+++ b/numpy/core/src/umathmodule.c.src
@@ -1633,8 +1633,11 @@ static void
for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
x = *((@typ@ *)i1);
y = *((@typ@ *)i2);
- res = x - floor@c@(x/y)*y;
- *((@typ@ *)op)= res;
+ res = fmod@c@(x, y);
+ if (res && ((y < 0) != (res < 0))) {
+ res += y;
+ }
+ *((@typ@ *)op)= res;
}
}
/**end repeat**/