mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
Added FP to_ieee_bv to fpa_rewriter to enable model evaluation.
This commit is contained in:
parent
46e24e094c
commit
79d69cd5f0
8 changed files with 71 additions and 16 deletions
|
@ -1179,6 +1179,19 @@ void mpf_manager::to_sbv_mpq(mpf_rounding_mode rm, const mpf & x, scoped_mpq & o
|
|||
if (x.sign) m_mpq_manager.neg(o);
|
||||
}
|
||||
|
||||
void mpf_manager::to_ieee_bv_mpz(const mpf & x, scoped_mpz & o) {
|
||||
SASSERT(!is_nan(x) && !is_inf(x));
|
||||
SASSERT(exp(x) < INT_MAX);
|
||||
|
||||
unsigned sbits = x.get_sbits();
|
||||
unsigned ebits = x.get_ebits();
|
||||
m_mpz_manager.set(o, sgn(x));
|
||||
m_mpz_manager.mul2k(o, ebits);
|
||||
m_mpz_manager.add(o, exp(x), o);
|
||||
m_mpz_manager.mul2k(o, sbits - 1);
|
||||
m_mpz_manager.add(o, sig(x), o);
|
||||
}
|
||||
|
||||
void mpf_manager::rem(mpf const & x, mpf const & y, mpf & o) {
|
||||
SASSERT(x.sbits == y.sbits && x.ebits == y.ebits);
|
||||
|
||||
|
|
|
@ -207,6 +207,7 @@ public:
|
|||
unsigned prev_power_of_two(mpf const & a);
|
||||
|
||||
void to_sbv_mpq(mpf_rounding_mode rm, const mpf & x, scoped_mpq & o);
|
||||
void to_ieee_bv_mpz(const mpf & x, scoped_mpz & o);
|
||||
|
||||
protected:
|
||||
void mk_one(unsigned ebits, unsigned sbits, bool sign, mpf & o) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue