numba / numba

NumPy aware dynamic Python compiler using LLVM
https://numba.pydata.org/
BSD 2-Clause "Simplified" License
9.67k stars 1.11k forks source link

`np.fmod` doesn't work with negative inputs #8574

Open benwilliamgraham opened 1 year ago

benwilliamgraham commented 1 year ago

The current implementation doesn't follow numpy's fmod implementation which states:

The remainder has the same sign as the dividend x1

Ex:

>>> np.fmod(-4, 10)
-4
>>> numba.jit(lambda: np.fmod(-4, 10))()
2
gmarkall commented 1 year ago

Thanks for the report, I can reproduce this behaviour.