diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-07-06 21:41:57 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-07-06 21:41:57 +0000 |
commit | 3ea289e92d3a53bc296cb6a0a26bcafaee7ca48e (patch) | |
tree | dedce253c4017984016305811c0578c6475363bb /numpy/core/src/umathmodule.c.src | |
parent | 03908e3a396a3612ce5bcc7ccd0bd40e004166ec (diff) | |
download | numpy-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.src | 7 |
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**/ |