[Numpy-discussion] timedelta64 remainder behavior with div by 0
Tyler Reddy
tyler.je.reddy at gmail.com
Tue Jan 8 12:57:03 EST 2019
We are now at the stage of implementing the timedelta64 divmod inner loop
given very recent additions of floordiv and remainder inner loops for this
data type. However, there is some contention about a previous decision
regarding modulus behavior that we'd like to resolve before we bake it in
to divmod.
Currently, a modulus operation with two timedelta64 operands with a 0
denominator returns 0. For example:
np.timedelta64(5) % np.timedelta64(0) -> numpy.timedelta64(0)
In contrast, np.float64(1) % np.float64(0) -> nan
There's a suggestion that we should switch to returning NaT for the
timedelta64 case for consistency, and that this probably isn't too harmful
given how recent these additions are.
Do we have consensus on this?
Ref: https://github.com/numpy/numpy/pull/12683
Thanks!
Tyler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190108/bc236bf2/attachment.html>
More information about the NumPy-Discussion
mailing list