diff options
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**/ |