Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace x - (x // y) * y with x % y in divmod
`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`.
- Loading branch information