-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Comparing Int with float unexpected results #6482
Comments
hgvk94
pushed a commit
to hgvk94/z3
that referenced
this issue
Mar 27, 2023
Signed-off-by: Nikolaj Bjorner <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
comparing an integer decision variable with a floating point number gives wrong results because the float gets converted to an integer
example in python:
x = Int('x')
s = Solver()
s.add(x >= 0.1)
s.add(x < 1)
print(s.check())
#sat but should be unsat
m = s.model()
print(m) #gives x = 0
I believe the issue is located in the function _coerce_exprs at line 1214 in z3.py
Because the rhs is not an expression it is typecast to the type of the lhs, in this case leading to the constraint x >= 0 instead of x >= 0.1
The text was updated successfully, but these errors were encountered: