mirror of
https://github.com/Z3Prover/z3
synced 2025-06-19 12:23:38 +00:00
Fixed memory leak
This commit is contained in:
parent
c3ff342bea
commit
034e4f469e
2 changed files with 6 additions and 5 deletions
|
@ -696,6 +696,7 @@ extern "C" {
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
ast_manager & m = mk_c(c)->m();
|
ast_manager & m = mk_c(c)->m();
|
||||||
mpf_manager & mpfm = mk_c(c)->fpa_util().fm();
|
mpf_manager & mpfm = mk_c(c)->fpa_util().fm();
|
||||||
|
unsynch_mpz_manager & mpzm = mpfm.mpz_manager();
|
||||||
unsynch_mpq_manager & mpqm = mpfm.mpq_manager();
|
unsynch_mpq_manager & mpqm = mpfm.mpq_manager();
|
||||||
fpa_decl_plugin * plugin = (fpa_decl_plugin*)m.get_plugin(mk_c(c)->get_fpa_fid());
|
fpa_decl_plugin * plugin = (fpa_decl_plugin*)m.get_plugin(mk_c(c)->get_fpa_fid());
|
||||||
scoped_mpf val(mpfm);
|
scoped_mpf val(mpfm);
|
||||||
|
@ -709,7 +710,9 @@ extern "C" {
|
||||||
}
|
}
|
||||||
unsigned sbits = val.get().get_sbits();
|
unsigned sbits = val.get().get_sbits();
|
||||||
scoped_mpq q(mpqm);
|
scoped_mpq q(mpqm);
|
||||||
mpqm.set(q, mpfm.sig_normalized(val));
|
scoped_mpz sn(mpzm);
|
||||||
|
mpfm.sig_normalized(val, sn);
|
||||||
|
mpqm.set(q, sn);
|
||||||
mpqm.div(q, mpfm.m_powers2(sbits - 1), q);
|
mpqm.div(q, mpfm.m_powers2(sbits - 1), q);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
mpqm.display_decimal(ss, q, sbits);
|
mpqm.display_decimal(ss, q, sbits);
|
||||||
|
|
|
@ -146,14 +146,12 @@ public:
|
||||||
|
|
||||||
bool sgn(mpf const & x) const { return x.sign; }
|
bool sgn(mpf const & x) const { return x.sign; }
|
||||||
const mpz & sig(mpf const & x) const { return x.significand; }
|
const mpz & sig(mpf const & x) const { return x.significand; }
|
||||||
mpz sig_normalized(mpf const & x) {
|
void sig_normalized(mpf const & x, mpz & res) {
|
||||||
mpf t;
|
mpf t;
|
||||||
set(t, x);
|
set(t, x);
|
||||||
unpack(t, true);
|
unpack(t, true);
|
||||||
mpz r;
|
mpz_manager().set(res, t.significand);
|
||||||
mpz_manager().set(r, t.significand);
|
|
||||||
del(t);
|
del(t);
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
const mpf_exp_t & exp(mpf const & x) const { return x.exponent; }
|
const mpf_exp_t & exp(mpf const & x) const { return x.exponent; }
|
||||||
mpf_exp_t exp_normalized(mpf const & x) {
|
mpf_exp_t exp_normalized(mpf const & x) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue