summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorTim King <taking@google.com>2015-10-23 19:03:24 -0700
committerTim King <taking@google.com>2015-10-23 19:03:24 -0700
commitdbc9516df982e255dfe48a98c95a6ab55326aba6 (patch)
tree197bc63b0864175c668b66958cc2787d0142318e /src/util
parenta7a9ba359a2a8a26f20ac8fdf5292c4e0e27c76a (diff)
This patch slightly generalizes how the std::isfinite function in <cmath> is referred.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/rational_gmp_imp.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/util/rational_gmp_imp.cpp b/src/util/rational_gmp_imp.cpp
index 155faebf2..d7f9e2e22 100644
--- a/src/util/rational_gmp_imp.cpp
+++ b/src/util/rational_gmp_imp.cpp
@@ -24,13 +24,17 @@
# error "This source should only ever be built if CVC4_GMP_IMP is on !"
#endif /* CVC4_GMP_IMP */
-using namespace std;
-using namespace CVC4;
+std::ostream& CVC4::operator<<(std::ostream& os, const Rational& q){
+ return os << q.toString();
+}
+
+namespace CVC4 {
/* Computes a rational given a decimal string. The rational
* version of <code>xxx.yyy</code> is <code>xxxyyy/(10^3)</code>.
*/
Rational Rational::fromDecimal(const std::string& dec) {
+ using std::string;
// Find the decimal point, if there is one
string::size_type i( dec.find(".") );
if( i != string::npos ) {
@@ -48,9 +52,6 @@ Rational Rational::fromDecimal(const std::string& dec) {
}
}
-std::ostream& CVC4::operator<<(std::ostream& os, const Rational& q){
- return os << q.toString();
-}
/** Equivalent to calling (this->abs()).cmp(b.abs()) */
@@ -83,7 +84,8 @@ int Rational::absCmp(const Rational& q) const{
/** Return an exact rational for a double d. */
Rational Rational::fromDouble(double d) throw(RationalFromDoubleException){
- if(std::isfinite(d)){
+ using namespace std;
+ if(isfinite(d)){
Rational q;
mpq_set_d(q.d_value.get_mpq_t(), d);
return q;
@@ -101,3 +103,5 @@ RationalFromDoubleException::RationalFromDoubleException(double d) throw()
ss << ")";
setMessage(ss.str());
}
+
+} /* namespace CVC4 */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback