From: Tim King Date: Sat, 5 Mar 2011 16:59:13 +0000 (+0000) Subject: - Made Rational::sgn() function const. X-Git-Tag: cvc5-1.0.0~8670 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=042ee6a15455d3f4193d55cbb2d3d18da3e34776;p=cvc5.git - Made Rational::sgn() function const. --- diff --git a/src/util/rational_cln_imp.h b/src/util/rational_cln_imp.h index d81ad86ab..c05d47175 100644 --- a/src/util/rational_cln_imp.h +++ b/src/util/rational_cln_imp.h @@ -181,16 +181,15 @@ public: } - int sgn() { - cln::cl_RA sign = cln::signum(d_value); - if(sign == 0) - return 0; - else if(sign == -1) - return -1; - else if(sign == 1) + int sgn() const { + if(cln::zerop(d_value)){ + return 0; + }else if(cln::minusp(d_value)){ + return -1; + }else{ + Assert(cln::plusp(d_value)); return 1; - else - Unreachable(); + } } Rational& operator=(const Rational& x){ diff --git a/src/util/rational_gmp_imp.h b/src/util/rational_gmp_imp.h index 976544e7f..7af1b86df 100644 --- a/src/util/rational_gmp_imp.h +++ b/src/util/rational_gmp_imp.h @@ -166,7 +166,7 @@ public: } - int sgn() { + int sgn() const { return mpq_sgn(d_value.get_mpq_t()); }