mirror of
https://github.com/Z3Prover/z3
synced 2025-06-13 09:26:15 +00:00
Improve html pretty printer for RCF package
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
77f58269ed
commit
4624919786
8 changed files with 17 additions and 6 deletions
|
@ -51,7 +51,6 @@ def MkRoots(p, ctx=None):
|
||||||
return r
|
return r
|
||||||
|
|
||||||
class RCFNum:
|
class RCFNum:
|
||||||
html = False
|
|
||||||
def __init__(self, num, ctx=None):
|
def __init__(self, num, ctx=None):
|
||||||
# TODO: add support for converting AST numeral values into RCFNum
|
# TODO: add support for converting AST numeral values into RCFNum
|
||||||
if isinstance(num, RCFNumObj):
|
if isinstance(num, RCFNumObj):
|
||||||
|
@ -68,10 +67,10 @@ class RCFNum:
|
||||||
return self.ctx.ref()
|
return self.ctx.ref()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return Z3_rcf_num_to_string(self.ctx_ref(), self.num, False, RCFNum.html)
|
return Z3_rcf_num_to_string(self.ctx_ref(), self.num, False, in_html_mode())
|
||||||
|
|
||||||
def compact_str(self):
|
def compact_str(self):
|
||||||
return Z3_rcf_num_to_string(self.ctx_ref(), self.num, True, RCFNum.html)
|
return Z3_rcf_num_to_string(self.ctx_ref(), self.num, True, in_html_mode())
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
v = _to_rcfnum(other, self.ctx)
|
v = _to_rcfnum(other, self.ctx)
|
||||||
|
|
|
@ -1300,7 +1300,7 @@ namespace realclosure {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mk_infinitesimal(numeral & r) {
|
void mk_infinitesimal(numeral & r) {
|
||||||
mk_infinitesimal(symbol(next_infinitesimal_idx()), symbol(next_infinitesimal_idx()), r);
|
mk_infinitesimal(symbol(next_infinitesimal_idx()+1), symbol(next_infinitesimal_idx()+1), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void refine_transcendental_interval(transcendental * t) {
|
void refine_transcendental_interval(transcendental * t) {
|
||||||
|
@ -1352,7 +1352,7 @@ namespace realclosure {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mk_transcendental(mk_interval & proc, numeral & r) {
|
void mk_transcendental(mk_interval & proc, numeral & r) {
|
||||||
mk_transcendental(symbol(next_transcendental_idx()), symbol(next_transcendental_idx()), proc, r);
|
mk_transcendental(symbol(next_transcendental_idx()+1), symbol(next_transcendental_idx()+1), proc, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mk_pi(numeral & r) {
|
void mk_pi(numeral & r) {
|
||||||
|
|
|
@ -339,7 +339,7 @@ void display_pp(std::ostream & out,
|
||||||
ext_numeral_kind ak) {
|
ext_numeral_kind ak) {
|
||||||
switch (ak) {
|
switch (ak) {
|
||||||
case EN_MINUS_INFINITY: out << "-∞"; break;
|
case EN_MINUS_INFINITY: out << "-∞"; break;
|
||||||
case EN_NUMERAL: m.display(out, a); break;
|
case EN_NUMERAL: m.display_pp(out, a); break;
|
||||||
case EN_PLUS_INFINITY: out << "+∞"; break;
|
case EN_PLUS_INFINITY: out << "+∞"; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,6 +399,14 @@ void mpbq_manager::display(std::ostream & out, mpbq const & a) {
|
||||||
out << "^" << a.m_k;
|
out << "^" << a.m_k;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mpbq_manager::display_pp(std::ostream & out, mpbq const & a) {
|
||||||
|
out << m_manager.to_string(a.m_num);
|
||||||
|
if (a.m_k > 0)
|
||||||
|
out << "/2";
|
||||||
|
if (a.m_k > 1)
|
||||||
|
out << "<sup>" << a.m_k << "</sup>";
|
||||||
|
}
|
||||||
|
|
||||||
void mpbq_manager::display_smt2(std::ostream & out, mpbq const & a, bool decimal) {
|
void mpbq_manager::display_smt2(std::ostream & out, mpbq const & a, bool decimal) {
|
||||||
if (a.m_k == 0) {
|
if (a.m_k == 0) {
|
||||||
m_manager.display_smt2(out, a.m_num, decimal);
|
m_manager.display_smt2(out, a.m_num, decimal);
|
||||||
|
|
|
@ -260,6 +260,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
void display(std::ostream & out, mpbq const & a);
|
void display(std::ostream & out, mpbq const & a);
|
||||||
|
void display_pp(std::ostream & out, mpbq const & a);
|
||||||
void display_decimal(std::ostream & out, mpbq const & a, unsigned prec = 8);
|
void display_decimal(std::ostream & out, mpbq const & a, unsigned prec = 8);
|
||||||
/**
|
/**
|
||||||
\brief Display a in decimal while its digits match b digits.
|
\brief Display a in decimal while its digits match b digits.
|
||||||
|
|
|
@ -464,6 +464,7 @@ public:
|
||||||
|
|
||||||
void display_raw(std::ostream & out, mpff const & n) const;
|
void display_raw(std::ostream & out, mpff const & n) const;
|
||||||
void display(std::ostream & out, mpff const & n) const;
|
void display(std::ostream & out, mpff const & n) const;
|
||||||
|
void display_pp(std::ostream & out, mpff const & n) const { display(out, n); }
|
||||||
void display_decimal(std::ostream & out, mpff const & n, unsigned prec=32, unsigned max_power=128) const;
|
void display_decimal(std::ostream & out, mpff const & n, unsigned prec=32, unsigned max_power=128) const;
|
||||||
void display_smt2(std::ostream & out, mpff const & n, bool decimal=true) const;
|
void display_smt2(std::ostream & out, mpff const & n, bool decimal=true) const;
|
||||||
|
|
||||||
|
|
|
@ -382,6 +382,7 @@ public:
|
||||||
unsigned prev_power_of_two(mpfx const & a);
|
unsigned prev_power_of_two(mpfx const & a);
|
||||||
|
|
||||||
void display(std::ostream & out, mpfx const & n) const;
|
void display(std::ostream & out, mpfx const & n) const;
|
||||||
|
void display_pp(std::ostream & out, mpfx const & n) const { display(out, n); }
|
||||||
void display_smt2(std::ostream & out, mpfx const & n) const;
|
void display_smt2(std::ostream & out, mpfx const & n) const;
|
||||||
void display_decimal(std::ostream & out, mpfx const & n, unsigned prec = UINT_MAX) const;
|
void display_decimal(std::ostream & out, mpfx const & n, unsigned prec = UINT_MAX) const;
|
||||||
void display_raw(std::ostream & out, mpfx const & n) const;
|
void display_raw(std::ostream & out, mpfx const & n) const;
|
||||||
|
|
|
@ -259,6 +259,7 @@ public:
|
||||||
void display(std::ostream & out, mpz const & a) const { return mpz_manager<SYNCH>::display(out, a); }
|
void display(std::ostream & out, mpz const & a) const { return mpz_manager<SYNCH>::display(out, a); }
|
||||||
|
|
||||||
void display(std::ostream & out, mpq const & a) const;
|
void display(std::ostream & out, mpq const & a) const;
|
||||||
|
void display_pp(std::ostream & out, mpq const & a) const { display(out, a); }
|
||||||
|
|
||||||
void display_smt2(std::ostream & out, mpz const & a, bool decimal) const { return mpz_manager<SYNCH>::display_smt2(out, a, decimal); }
|
void display_smt2(std::ostream & out, mpz const & a, bool decimal) const { return mpz_manager<SYNCH>::display_smt2(out, a, decimal); }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue