Commits

Lionel Flandrin committed 14d3849

Fixed formatting error in default Float printer

  • Participants
  • Parent commits 89765af

Comments (0)

Files changed (5)

   if (rem) {
     PrintDec pd;
 
-    o << " (+ ";
+    o << ' ';
+
+    if (rem > 0)
+      o << '+';
+
     pd.print_float(o, rem);
-    o << ')';
   }
 }
 
   return mpz_cmp_si(this->v, i) < 0;
 }
 
+bool Integer::operator>(int i) const
+{
+  return mpz_cmp_si(this->v, i) > 0;
+}
+
 bool Integer::operator==(int i) const
 {
   return !mpz_cmp_si(this->v, i);
   return mpf_cmp_si(this->v, i) < 0;
 }
 
+bool Float::operator>(int i) const
+{
+  return mpf_cmp_si(this->v, i) > 0;
+}
+
 bool Float::operator==(int i) const
 {
   return !mpf_cmp_si(this->v, i);
     virtual Value &operator*=(const Value &);
     virtual Value &operator/=(const Value &);
     virtual bool   operator< (int) const;
+    virtual bool   operator> (int) const;
     virtual bool   operator==(int) const;
 
     Integer &operator&=(const Integer &);
     virtual Value &operator*=(const Value &);
     virtual Value &operator/=(const Value &);
     virtual bool   operator< (int) const;
+    virtual bool   operator> (int) const;
     virtual bool   operator==(int) const;
   };
 

tests/expected-output.txt

 4'shb
 8'hff
 2'sh3
+4'ha +0.1
+5'sh16 -0.1
           ^^^^^ division by 0
           ^^^^^^^^^^^^^^^^ division by 0
 5
 -5:v
 0xff:v
 -0b1:v
+10.1:v
+-10.1:v
 
 # Error handling
 42 + 1 / 0