Commit bed50c9b authored by Taddeüs Kroes's avatar Taddeüs Kroes

Minified numbers are now rounded to 2 decimal digits

parent bcf78917
......@@ -147,13 +147,16 @@ let string_of_stylesheet = cat "\n\n" string_of_statement
*)
let minify_num n =
(* Round numbers to at most 2 decimal digits *)
let round2 n = floor (100. *. n +. 0.5) /. 100. in
if float_of_int (int_of_float n) = n then
string_of_int (int_of_float n)
else if n < 1.0 && n > -1.0 then
let s = string_of_float n in
let s = string_of_float (round2 n) in
String.sub s 1 (String.length s - 1)
else
string_of_float n
string_of_float (round2 n)
let rec minify_expr = function
| Concat values -> cat " " minify_expr values
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment