diff options
author | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-05-06 20:07:51 +0000 |
---|---|---|
committer | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-05-06 20:07:51 +0000 |
commit | e909abcaf122e7c426d2b078728679f43a8ca442 (patch) | |
tree | 76b30fe96fe097770e7ab90518d945fd41555b76 /src/util/integer.h | |
parent | 4e365ace4baa9eb519268c621ac69843a0599208 (diff) |
Implementing Rational::fromDecimal and adding support for real constants in SMT parsers
Diffstat (limited to 'src/util/integer.h')
-rw-r--r-- | src/util/integer.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/util/integer.h b/src/util/integer.h index 2aa8b711a..c019144a9 100644 --- a/src/util/integer.h +++ b/src/util/integer.h @@ -52,8 +52,8 @@ public: /** * Constructs a Integer from a C string. - * Throws std::invalid_argument if the stribng is not a valid rational. - * For more information about what is a vaid rational string, + * Throws std::invalid_argument if the string is not a valid rational. + * For more information about what is a valid rational string, * see GMP's documentation for mpq_set_str(). */ Integer(const char * s, int base = 10): d_value(s,base) {} @@ -120,6 +120,16 @@ public: return Integer( d_value / y.d_value ); } + /** Raise this Integer to the power <code>exp</code>. + * + * @param exp the exponent + */ + Integer pow(unsigned long int exp) const { + mpz_class result; + mpz_pow_ui(result.get_mpz_t(),d_value.get_mpz_t(),exp); + return Integer( result ); + } + std::string toString(int base = 10) const{ return d_value.get_str(base); } |