Repository navigation
ENH: add mm->qm divmod - #12683
ENH: add mm->qm divmod#12683
Conversation
dc409f9 to
4aee1be
Compare
|
Revised based on feedback so far -- if |
|
We might want to consult the mailing list on whether we should revise the behavior of Otherwise looks good to me. |
|
Ah, I'd forgotten how recently we added modulo support (#12120), so we can probably get away with fixing it, especially if we backport. Was there any discussion about what %0 should return there? |
|
@eric-wieser : I do not remember that in #12120 the %0 case was discussed: I would suggest to consider the current behaviour ( There are still some open points in the
IMHO currently (1.16.0rc2) we have
|
|
4aee1be to
28c5296
Compare
|
Revised the PR with separate commits for the remainder bug fix and the feature addition / typecast cleanup, so that the former may be backported if desired. |
|
I'd probably be in favor of just backporting everything |
eric-wieser
left a comment
There was a problem hiding this comment.
Looks good to me, but needs a release note. Since this is a simple extension, and divmod is something I'd expect to exist alongside %, I think we should all of this in 1.16, not just the bug fix.
Needs a release note in either 1.16 or 1.17, depending on what we decide.
28c5296 to
3674ea1
Compare
|
Refined the test as requested & removed WIP tag. I'll hold off on the release note until we have a decision on the milestone target. |
|
Considering how super new it is, I guess it is fine to put the NaN fix definitely into 1.16 (even 1.16.1, don't want to make things weird with already rc's out for long). Backporting the new functionality seems OK to me as well, since even if there is something wrong, I don't think it can possibly cause a regression. If this wasn't the LTS I would probably be against it. So I would say: lets just target 1.16.1. |
|
If we want it in 1.16, should try rebasing on that branch with a release note, then forward port without the release note. The 1.16 release notes will be forward ported after release. I would like to make the 1.16 release this weekend. |
|
I'll tentatively add the |
|
Rebasing on f07a38d will make both the forward and backport easy |
|
Needs a release note. Put it in the 1.17.0-notes and I'll copy it to the 1.16.1-notes. @eric-wieser backports are really easy anyway unless there are a ton of commits with conflicts. I'll be interested to see if Tyler can still add the release note without problems. |
* modulus operation with two timedelta64 operands now returns NaT in the case of division by zero, rather than returning zero
* add timedelta64 divmod inner loop with type signature mm->qm * also adjusted typecasting in mm_q floor division to match the approach used here (should not change any behavior)
3674ea1 to
4b81a24
Compare
|
Ok, added a release note (via an amend), rebased on latest master, and force pushed. This will obviously increase the likelihood of master branch merge conflict eventually. |
| assert_equal(divmod(op1, op2), expected) | ||
|
|
||
| @pytest.mark.parametrize("op1, op2", [ | ||
| # reuse cases from floordiv |
There was a problem hiding this comment.
Can you reuse them in the source by creating a global variable with these cases?
There was a problem hiding this comment.
or a class (same thing, just makes the global state local to the class)
| divmod operation is now supported for two ``timedelta64`` operands | ||
| ------------------------------------------------------------------ | ||
| The divmod operator now handles two ``np.timedelta64`` operands, with | ||
| type signature mm->qm. |
|
two small nits, but not critical. Will merge later today |
|
Thanks Tyler |
|
I've made the additions to the 1.16.1 release notes. |
This still needs work -- something isn't quite right according to the unit tests.Would be nice if an inner loop that performs the operations of two other inner loops could just gracefully call the those other two inner loops, but I think Eric & I have had that discussion before & there are issues with i.e., nesting binop loops.