-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
ENH: add mm->q floordiv #12308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: add mm->q floordiv #12308
Conversation
Hmm, seems weird to be to have floordiv return float - I'm not sure if that's better or worse than losing NaTs. |
@shoyer Should I switch to returning an int and do something else with NaT? |
Based on in-person discussion with @shoyer & @eric-wieser I should likely revise this to return integer values. For the case of |
Note that this behavior will be consistent with other cases where ufuncs
have undefined behavior, e.g., dividing by 0.
…On Sat, Dec 1, 2018 at 10:52 AM Tyler Reddy ***@***.***> wrote:
Based on in-person discussion with @shoyer <https://github.com/shoyer> &
@eric-wieser <https://github.com/eric-wieser> I should likely revise this
to return integer values.
For the case of NaT in the numerator, denominator, or both, use error
flag to emit warning & return 0.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12308 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABKS1rmE-7xKAN9eO-7XIP5s-eMhlP_Mks5u0s_sgaJpZM4YLE9d>
.
|
2e99c1a
to
a8bee2e
Compare
Refactored to return integer type -- tests pass locally anyway. I wonder what reviewers will think about the way I intercepted floor division for type resolution between m8 types -- is the strcmp too fragile? It is readable at least. |
a8bee2e
to
bbb6bda
Compare
Can you construct a test that would fail if we lost precision through a float? |
21ab174
to
3ed3494
Compare
Yes, I've added precision unit tests for both code paths based on integers that a double can't represent exactly. Since |
3ed3494
to
ad96b91
Compare
* add support for floor division between timedelta64 (m8) operands with generic or specific units; type signature is mm->q
ad96b91
to
2494d11
Compare
Thanks Tyler |
Motivated by #12120 (comment)
Add support for floor division between
timedelta64
operands with type signature:mm->q
I triedmm->q
for closer mimic with built-in timedelta, but that makes it tricky to handleNaT-> NaN
.Maybe there's a cleaner / more efficient way to deal with negative values.