]> granicus.if.org Git - json-c/commitdiff
Issue #59: change the floating point output format to %.17g so values with more than...
authorEric Haszlakiewicz <erh+git@nimenees.com>
Thu, 12 Sep 2013 02:09:43 +0000 (21:09 -0500)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Thu, 12 Sep 2013 02:09:43 +0000 (21:09 -0500)
json_object.c

index 118def765fd319f40313a5788affb9c36c67ab46..faf61930c65715e6a621417ecafb0608806c80b7 100644 (file)
@@ -577,7 +577,7 @@ static int json_object_double_to_json_string(struct json_object* jso,
     else
       size = snprintf(buf, sizeof(buf), "-Infinity");
   else
-    size = snprintf(buf, sizeof(buf), "%f", jso->o.c_double);
+    size = snprintf(buf, sizeof(buf), "%.17g", jso->o.c_double);
 
   p = strchr(buf, ',');
   if (p) {