diff --git a/lib/value.ml b/lib/value.ml index 6679317..75c7194 100644 --- a/lib/value.ml +++ b/lib/value.ml @@ -4,7 +4,7 @@ type lox_value = String of string | Number of float | Bool of bool | Nil let string_of_lox_value lox_value = match lox_value with | String s -> s - | Number x -> string_of_float x + | Number x -> if Float.is_integer x then string_of_int (Int.of_float x) else string_of_float x | Bool b -> string_of_bool b | Nil -> "nil"