···7373 | Null -> Fmt.string ppf "null"
7474 | Bool b -> Fmt.bool ppf b
7575 | Number f ->
7676- if Float.is_integer f && Float.is_finite f then Fmt.pf ppf "%.0f" f
7777- else Fmt.float ppf f
7676+ if Float.is_integer f && Float.is_finite f && Float.abs f < 1e16 then
7777+ Fmt.pf ppf "%.0f" f
7878+ else
7979+ (* Go's [%v] for floats prints the shortest round-trippable form;
8080+ [%g] is the closest stdlib match. *)
8181+ Fmt.pf ppf "%g" f
7882 | String s -> Fmt.pf ppf "%S" s
7983 | Array items -> Fmt.pf ppf "[%a]" (Fmt.list ~sep:(Fmt.any ", ") pp) items
8084 | Set items -> Fmt.pf ppf "{%a}" (Fmt.list ~sep:(Fmt.any ", ") pp) items