Use %g instead of %f for double formatting

This can probably be refined further. This is just an improvement to get
rid of unnecessary trailing zeroes.
This commit is contained in:
ktkk 2025-10-10 15:03:04 +00:00
parent de2dd71bf3
commit 932b593a58

2
json.c
View file

@ -117,7 +117,7 @@ void json_add_long(Json* json, long value)
void json_add_double(Json* json, double value) void json_add_double(Json* json, double value)
{ {
begin_value(json); begin_value(json);
fprintf(json->stream, "%f", value); fprintf(json->stream, "%g", value);
end_value(json); end_value(json);
} }