diff options
author | Tim King <taking@cs.nyu.edu> | 2018-01-07 16:46:16 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-07 16:46:16 -0800 |
commit | 20957db27201d594a83e0e5abe77875ed4932faf (patch) | |
tree | 47c665493a2a26d9ad50d2f53de310a7ce8193e0 /src/util/rational_gmp_imp.cpp | |
parent | 8497910df4d1c254b26f09c3dc5ee6191c970b12 (diff) |
Removes RationalFromDoubleException. Replaces this with an explicit M… (#1476)
* Removes RationalFromDoubleException. Replaces this with an explicit Maybe<Rational> datatype. Makes Maybe<T> CVC4_PUBLIC. Updates the users of Rational::fromDouble(). Miscellaneous cleanup of ApproxSimplex.
Diffstat (limited to 'src/util/rational_gmp_imp.cpp')
-rw-r--r-- | src/util/rational_gmp_imp.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/util/rational_gmp_imp.cpp b/src/util/rational_gmp_imp.cpp index 527222f7a..40c9c35f3 100644 --- a/src/util/rational_gmp_imp.cpp +++ b/src/util/rational_gmp_imp.cpp @@ -87,25 +87,15 @@ int Rational::absCmp(const Rational& q) const{ /** Return an exact rational for a double d. */ -Rational Rational::fromDouble(double d) throw(RationalFromDoubleException){ +Maybe<Rational> Rational::fromDouble(double d) +{ using namespace std; if(isfinite(d)){ Rational q; mpq_set_d(q.d_value.get_mpq_t(), d); return q; } - - throw RationalFromDoubleException(d); -} - -RationalFromDoubleException::RationalFromDoubleException(double d) throw() - : Exception() -{ - std::stringstream ss; - ss << "RationalFromDoubleException("; - ss << d; - ss << ")"; - setMessage(ss.str()); + return Maybe<Rational>(); } } /* namespace CVC4 */ |