3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

adding review notes to code

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2013-10-26 16:24:21 +08:00
commit 9903c722af
7 changed files with 215 additions and 103 deletions

View file

@ -155,6 +155,17 @@ class inf_int_rational {
return *this;
}
inf_int_rational & operator*=(const rational & r) {
if (!r.is_int32()) {
throw default_exception("multiplication with large rational is not possible");
}
m_first *= r;
m_second *= r.get_int32();
return *this;
}
inf_int_rational & operator-=(const inf_int_rational & r) {
m_first -= r.m_first;
m_second -= r.m_second;
@ -344,6 +355,10 @@ inline inf_int_rational operator+(const inf_int_rational & r1, const inf_int_rat
return inf_int_rational(r1) += r2;
}
inline inf_int_rational operator*(const rational & r1, const inf_int_rational & r2) {
return inf_int_rational(r2) *= r1;
}
inline inf_int_rational operator-(const inf_int_rational & r1, const inf_int_rational & r2) {
return inf_int_rational(r1) -= r2;
}

View file

@ -111,6 +111,11 @@ public:
return INT_MIN <= v && v <= INT_MAX;
}
int get_int32() const {
SASSERT(is_int32());
return (int)get_int64();
}
double get_double() const { return m().get_double(m_val); }
rational const & get_rational() const { return *this; }