forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mod semantics for
Z3Ops
. (pytorch#104827)
Python `mod` semantics is not the same as the mathematical modulus operation. According to the Python reference: `a = floor(a / b) * b + a % r`. In other words: `a % b = a - floor(a / b) * b`. This PR fixes the old implementation which used SMT-LIB2 semantics for `mod`. In short, it only worked with integers and had the following guarantee: `0 <= a % b < b`. In summary, the changes are: - `a % b = a - floordiv(a, b) * b` - `a` and `b` can be both integer or real - The result will be real if any of the arguments is real. Otherwise, it will be integer Pull Request resolved: pytorch#104827 Approved by: https://github.com/lezcano
- Loading branch information
1 parent
951b9a6
commit d5dbe77
Showing
2 changed files
with
14 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters