From 9790cf2241596f7b79e244b87e2731238b1b2aac Mon Sep 17 00:00:00 2001 From: Jorgen Birkler Date: Fri, 28 Dec 2012 10:01:51 -0800 Subject: [PATCH] Chaning double output from %f to %g to allow seralization of doubles with very large exponents without loosing precision. --- json_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json_object.c b/json_object.c index a84785c..2e47836 100644 --- a/json_object.c +++ b/json_object.c @@ -552,7 +552,7 @@ static int json_object_double_to_json_string(struct json_object* jso, int level, int flags) { - return sprintbuf(pb, "%f", jso->o.c_double); + return sprintbuf(pb, "%.20g", jso->o.c_double); } struct json_object* json_object_new_double(double d)