-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It's a bit difficult to work with `Real` (in `z3`, not `z3-sys`) since the only provided way to get a value out at the end is `Real::as_real(&self) -> Option<(i64, i64)>`, which really only works for rational numbers. In this PR I've added two new functions to help: * `Real::approx(&self, precision: usize) -> ::std::string::String`, which gives a string approximation of the real value up to `precision` correct digits after the decimal (via `Z3_get_numeral_decimal_string`). * `Real::approx_f64(&self) -> f64`, which is just a convenience wrapper for `self.approx(17).parse().unwrap()` to get a full-precision `f64` approximation of the real number.
- Loading branch information
Showing
3 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters