summaryrefslogtreecommitdiff
path: root/src/util/rational_gmp_imp.cpp
diff options
context:
space:
mode:
authorTim King <taking@cs.nyu.edu>2018-01-07 16:46:16 -0800
committerGitHub <noreply@github.com>2018-01-07 16:46:16 -0800
commit20957db27201d594a83e0e5abe77875ed4932faf (patch)
tree47c665493a2a26d9ad50d2f53de310a7ce8193e0 /src/util/rational_gmp_imp.cpp
parent8497910df4d1c254b26f09c3dc5ee6191c970b12 (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.cpp16
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 */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback