-
Notifications
You must be signed in to change notification settings - Fork 115
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
Add creating reals from any numeral and getting f64 from reals #287
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.
If you can make the suggested change and help get this to pass the relevant parts of CI, that'd be great.
z3/src/ast.rs
Outdated
Self::from_str(ctx, &fraction_string) | ||
} | ||
|
||
/// The string may be of the form \[num\]*\[.\[num\]*\]\[E\[+|-\]\[num\]+\]. |
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.
Could you put ...
around the \[num\]...+\]
?
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.
Done!
1d38944
to
7d2698a
Compare
I fixed the relevant parts of the CI, and then accidentally clicked close pull request, whoops. |
But if that's not the intended behavior, I have a separate PR that works even for irrational numbers: #304, in which case we could drop the |
I didn't know |
|
Adds the ability to create Reals from any numeral using Z3_mk_numeral.
Also adds the method
as_f64
toReal
which uses Z3_get_numberal_double.This is useful if you want to represent a real as a f64. Currently you would have to calculate the numerator and denominator in order to create a z3 real from a f64. With this merge request all you would need to do is create a string from your f64 and pass this to
from_str
.