fix a bug in CLN rational printing where the base was ignored (was causing the new...
authorMorgan Deters <mdeters@gmail.com>
Tue, 28 Aug 2012 17:14:59 +0000 (17:14 +0000)
committerMorgan Deters <mdeters@gmail.com>
Tue, 28 Aug 2012 17:14:59 +0000 (17:14 +0000)
src/util/rational_cln_imp.h

index 969a8b5eb5b9ad50d658e16c6c150211c09d71ec..4247a1e63f11b4ffecd4b1cc95529996512795f0 100644 (file)
@@ -27,6 +27,8 @@
 #include <sstream>
 #include <cln/rational.h>
 #include <cln/input.h>
+#include <cln/io.h>
+#include <cln/output.h>
 #include <cln/rational_io.h>
 #include <cln/number_io.h>
 
@@ -299,8 +301,11 @@ public:
 
   /** Returns a string representing the rational in the given base. */
   std::string toString(int base = 10) const {
+    cln::cl_print_flags flags;
+    flags.rational_base = base;
+    flags.rational_readably = false;
     std::stringstream ss;
-    fprint(ss, d_value);
+    print_rational(ss, flags, d_value);
     return ss.str();
   }