Skip to content

Commit 7428b9c

Browse files
committed
solve the problems of mod operator except for infinite values numpy#18170
1 parent 31e232c commit 7428b9c

1 file changed

Lines changed: 1 addition & 23 deletions

File tree

‎numpy/core/src/npymath/npy_math_internal.h.src‎

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -423,16 +423,6 @@ NPY_INPLACE @type@ npy_@kind@@c@(@type@ x, @type@ y)
423423
NPY_INPLACE @type@
424424
npy_@kind@@c@(@type@ x, @type@ y)
425425
{
426-
int are_inputs_inf = (npy_isinf(x) && npy_isinf(y));
427-
/* force set invalid flag, doesnt raise by default on gcc < 8 */
428-
if (npy_isnan(x) || npy_isnan(y)) {
429-
npy_set_floatstatus_invalid();
430-
}
431-
if (are_inputs_inf || !y) {
432-
if (!npy_isnan(x)) {
433-
npy_set_floatstatus_invalid();
434-
}
435-
}
436426
return (@type@) npy_@kind@((double)x, (double) y);
437427
}
438428
#endif
@@ -518,16 +508,7 @@ NPY_INPLACE @type@ npy_@kind@@c@(@type@ x, @type@ y)
518508
NPY_INPLACE @type@
519509
npy_@kind@@c@(@type@ x, @type@ y)
520510
{
521-
int are_inputs_inf = (npy_isinf(x) && npy_isinf(y));
522-
/* force set invalid flag, doesnt raise by default on gcc < 8 */
523-
if (npy_isnan(x) || npy_isnan(y)) {
524-
npy_set_floatstatus_invalid();
525-
}
526-
if (are_inputs_inf || !y) {
527-
if (!npy_isnan(x)) {
528-
npy_set_floatstatus_invalid();
529-
}
530-
}
511+
531512
return @kind@@c@(x, y);
532513
}
533514
#endif
@@ -716,9 +697,6 @@ npy_divmod@c@(@type@ a, @type@ b, @type@ *modulus)
716697
@type@ div, mod, floordiv;
717698

718699
/* force set invalid flag, doesnt raise by default on gcc < 8 */
719-
if (npy_isnan(a) || npy_isnan(b)) {
720-
npy_set_floatstatus_invalid();
721-
}
722700
mod = npy_fmod@c@(a, b);
723701
if (NPY_UNLIKELY(!b)) {
724702
div = a / b;

0 commit comments

Comments
 (0)