Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lucascool12
Copy link

Adds the ability to create Reals from any numeral using Z3_mk_numeral.
Also adds the method as_f64 to Real 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.

Copy link
Contributor

@waywardmonkeys waywardmonkeys left a 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\]+\].
Copy link
Contributor

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\]...+\] ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@lucascool12
Copy link
Author

I fixed the relevant parts of the CI, and then accidentally clicked close pull request, whoops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants