diff options
Diffstat (limited to 'z3-solver/src')
-rw-r--r-- | z3-solver/src/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/z3-solver/src/lib.rs b/z3-solver/src/lib.rs index db907e7..6ad7ffc 100644 --- a/z3-solver/src/lib.rs +++ b/z3-solver/src/lib.rs | |||
@@ -31,7 +31,16 @@ impl Drop for Z3Context<'_> { | |||
31 | 31 | ||
32 | fn value_to_num_den(value: f64) -> (i32, i32) { | 32 | fn value_to_num_den(value: f64) -> (i32, i32) { |
33 | // TODO: FIXME: so hacky, because I'm so lazy... | 33 | // TODO: FIXME: so hacky, because I'm so lazy... |
34 | ((value * 1_000_000.) as _, 1_000_000) | 34 | |
35 | const FACTOR: f64 = 524_288.; | ||
36 | const FACTOR_I32: i32 = FACTOR as _; | ||
37 | const LIMIT: f64 = i32::MAX as f64 / FACTOR; | ||
38 | |||
39 | if value < LIMIT { | ||
40 | ((value * FACTOR) as _, FACTOR_I32) | ||
41 | } else { | ||
42 | (value as _, 1) | ||
43 | } | ||
35 | 44 | ||
36 | // let fract = value.fract(); | 45 | // let fract = value.fract(); |
37 | // let number_of_fract_digits = -fract.log10().floor(); | 46 | // let number_of_fract_digits = -fract.log10().floor(); |