numexpr
numexpr copied to clipboard
Incorrect result with python % (modulo) operator and integer variable
Python 3.9.13, numpy 1.23.0, numexpr 2.8.3
Hello and many thanks for a great library.
Using python modulo gives incorrect result if integer variable used w/ modulo operator.
solar = np.array([ -135 ])
Expected:
solar%360 array([225])
Incorrect answer using int variable:
ne.evaluate("solar%360") array([-135], dtype=int64)
Workaround, make left or right side a float:
ne.evaluate("solar%360.") array([225.])