-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
Fix mod semantics for Z3Ops
.
#104827
Fix mod semantics for Z3Ops
.
#104827
Conversation
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 [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/104827
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 3045c43: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
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 [ghstack-poisoned]
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 [ghstack-poisoned]
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 ghstack-source-id: a844a3877dbf2bb4c7fe1cade28cd6335f5f27c4 Pull Request resolved: #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 cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy chenyang78 [ghstack-poisoned]
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 ghstack-source-id: 350f45238b078209e74910a6dea950de99f651f6 Pull Request resolved: #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 cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy chenyang78 [ghstack-poisoned]
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 ghstack-source-id: 3cfc1535c0cc0badefcecb37f2e8f0f7b5542c46 Pull Request resolved: #104827
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Stack from ghstack (oldest at bottom):
Z3Ops
. #104827Python
mod
semantics is not the same as the mathematical modulus operation. According tothe 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, itonly 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
andb
can be both integer or realcc @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @ipiszy @chenyang78