8000 BUG: Refactor complex floor_divide to avoid osx-arm64 optimization wa… · numpy/numpy@8951e12 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8951e12

Browse files
erykoffrgommers
authored andcommitted
BUG: Refactor complex floor_divide to avoid osx-arm64 optimization warnings.
1 parent 29d8d93 commit 8951e12

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

numpy/core/src/umath/loops.c.src

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,21 +2521,16 @@ NPY_NO_EXPORT void
25212521
NPY_NO_EXPORT void
25222522
@TYPE@_floor_divide(char **args, npy_intp const *dimensions, npy_intp const *steps, void *NPY_UNUSED(func))
25232523
{
2524+
@ftype@ mod;
25242525
BINARY_LOOP {
25252526
const @ftype@ in1r = ((@ftype@ *)ip1)[0];
25262527
const @ftype@ in1i = ((@ftype@ *)ip1)[1];
25272528
const @ftype@ in2r = ((@ftype@ *)ip2)[0];
25282529
const @ftype@ in2i = ((@ftype@ *)ip2)[1];
2529-
if (npy_fabs@c@(in2r) >= npy_fabs@c@(in2i)) {
2530-
const @ftype@ rat = in2i/in2r;
2531-
((@ftype@ *)op1)[0] = npy_floor@c@((in1r + in1i*rat)/(in2r + in2i*rat));
2532-
((@ftype@ *)op1)[1] = 0;
2533-
}
2534-
else {
2535-
const @ftype@ rat = in2r/in2i;
2536-
((@ftype@ *)op1)[0] = npy_floor@c@((in1r*rat + in1i)/(in2i + in2r*rat));
2537-
((@ftype@ *)op1)[1] = 0;
2538-
}
2530+
((@ftype@ *)op1)[0] = npy_divmod@c@(in1r*in2r + in1i*in2i,
2531+
in2r*in2r + in2i*in2i,
2532+
&mod);
2533+
((@ftype@ *)op1)[1] = 0;
25392534
}
25402535
}
25412536

0 commit comments

Comments
 (0)
0