- Made Rational::sgn() function const.
authorTim King <taking@cs.nyu.edu>
Sat, 5 Mar 2011 16:59:13 +0000 (16:59 +0000)
committerTim King <taking@cs.nyu.edu>
Sat, 5 Mar 2011 16:59:13 +0000 (16:59 +0000)
src/util/rational_cln_imp.h
src/util/rational_gmp_imp.h

index d81ad86ababa96f0d1aa5a059c652b56cf40b685..c05d4717546eaf64f2e3f36ce39ddca6e5ffe435 100644 (file)
@@ -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){
index 976544e7f96fd79d1a41e8b9bbb6dcff7ec7065b..7af1b86df9804000bdece925e8058740fe9a6ecc 100644 (file)
@@ -166,7 +166,7 @@ public:
   }
 
 
-  int sgn() {
+  int sgn() const {
     return mpq_sgn(d_value.get_mpq_t());
   }