Commits

Dmitry Grebeniuk  committed fa94152

some code for Reading_num

  • Participants
  • Parent commits 20c59c0

Comments (0)

Files changed (1)

File iteratees.ml

       else
         let scale = String.length after_point in
         return &
-        Num.mult_num
-          (Num.num_of_string (before_point ^ after_point))
-          (Num.power_num ten (Num.num_of_int (-scale)))
+        let num = Num.num_of_string (before_point ^ after_point) in
+        if scale = 0
+        then num (* integers and rationals are represented differently,
+                    and I don't know whether [Num.mult_num n (1/10)^0]
+                    will keep [n] integer. *)
+        else
+          Num.mult_num
+            num
+            (Num.power_num ten (Num.num_of_int (-scale)))
     ;