-
Notifications
You must be signed in to change notification settings - Fork 75
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
make cil_exp_of_linexpr1 work with fractional expressions #1493
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add a (cram) test where we test that the information now actually appears in the witness. Maybe @sim642 can help setting that up?
if Scalar.is_infty scalar <> 0 then (* infinity means unbounded *) | ||
None | ||
else match scalar with | ||
| Float f -> if Stdlib.Float.is_integer f then Some (Q.of_float f) else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Zarith documentation, Q.of_float
is exact, so shouldn't this also work for non-integers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but in general, I would expect this case to happen, if we come from a float-based apron analysis. Correct me if I am wrong in the following argumentation:
These floats would likely stem from a floating point based analysis in apron, and thus would probably lead to very large denominators due to some +/-1 rounding in the low end of the mantissa. This might not hurt soundness so bad, since the result is only used to perform a scaling on the whole equality, but still the outcome might be very scary looking. In this implementation, I opted for a more conservative approach, just ignoring these floats.
Co-authored-by: Simmo Saan <[email protected]>
Co-authored-by: Simmo Saan <[email protected]>
Co-authored-by: Simmo Saan <[email protected]>
I should try this on our relational witnesses for Freiburg to see if this produces any new ones we couldn't before. |
Fixes #1328 , use Q instead of Z to extract coefficients, and then scale the coefficient with the lcm of their denominators.