Repository navigation
ENH: add mm->q floordiv - #12308
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
timedelta64operands with type signature:mm->qI triedmm->qfor 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.