|
|
@@ -5,6 +5,12 @@ let tab = " "
|
|
|
(* string -> string *)
|
|
|
let indent = Str.global_replace (Str.regexp "^\\(.\\)") (tab ^ "\\1")
|
|
|
|
|
|
+(* Add a trailing zero to a float stringification
|
|
|
+ * float -> string *)
|
|
|
+let float2string f = match string_of_float f with
|
|
|
+ | s when s.[String.length s - 1] = '.' -> s ^ "0"
|
|
|
+ | s -> s
|
|
|
+
|
|
|
(* operator -> string *)
|
|
|
let op2str = function
|
|
|
| Neg -> "-"
|
|
|
@@ -97,7 +103,7 @@ and node2str node =
|
|
|
(* Expressions *)
|
|
|
| BoolConst (b, _) -> string_of_bool b
|
|
|
| IntConst (i, _) -> string_of_int i
|
|
|
- | FloatConst (f, _) -> string_of_float f
|
|
|
+ | FloatConst (f, _) -> float2string f
|
|
|
| ArrayConst (dims, _) -> "[" ^ concat ", " dims ^ "]"
|
|
|
| Var (v, _) -> v
|
|
|
| Deref (name, dims, _) -> name ^ (str (ArrayConst (dims, noloc)))
|