Skip to content
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

implement intbounds for FloorDivide #856

Merged
merged 3 commits into from
Feb 29, 2024
Merged

Conversation

joostvanzwieten
Copy link
Member

No description provided.

If the lower bound is `inf`, no integer number will satisfy the lower bound,
which implies the array must have size zero, in which case the bounds are
useless. This patch disallows `inf` lower bounds and `-inf` upper bounds.
`evaluable.divmod(x, y)` returns `x - (x // y) * y` as remainder. There are
three issues with this:

*   When calling `evaluable.div`, `evaluable.mod` *and* `evaluable.divmod`
    we're doing extra work. This can be solved by changing the implementation
    of `evaluable.mod`, but:

*   It appears to be cheaper to compute the modulo using `numpy.mod` on x86
    since the remainder is a byproduct of the
    [div](https://www.felixcloutier.com/x86/div) instruction.

*   `evaluable.Mod` (note the capital) has an implementation for the integer
    bounds and the remainder of `evaluable.divmod` has not.

This patch changes the implementation of the remainder of `evaluable.divmod` to
`evaluable.Mod`.
@joostvanzwieten joostvanzwieten merged commit 58cfd7d into master Feb 29, 2024
23 checks passed
@joostvanzwieten joostvanzwieten deleted the floor-divide-intbounds branch February 29, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants