Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f15f5e

Browse files
authored
Merge pull request #24223 from hawkinsp/ub
BUG: Fix undefined behavior in complex pow().
2 parents 570b209 + 50282dc commit 8f15f5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

numpy/core/src/npymath/npy_math_complex.c.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ npy_cpow@c@ (@ctype@ a, @ctype@ b)
481481
r = npy_cpack@c@(NPY_NAN@C@, NPY_NAN@C@);
482482
return r;
483483
}
484-
if (bi == 0 && (n=(npy_intp)br) == br) {
484+
if (bi == 0 && br > -100 && br < 100 && (n=(npy_intp)br) == br) {
485485
if (n == 1) {
486486
/* unroll: handle inf better */
487487
return npy_cpack@c@(ar, ai);

0 commit comments

Comments
 (0)