From 222de81a197b05c3970d7a9a44e61e480672b91d Mon Sep 17 00:00:00 2001 From: Moritz Gmeiner Date: Mon, 26 Aug 2024 01:57:08 +0200 Subject: [PATCH] print ints as ints instead of floats i.e. no trailing dot --- lib/value.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"