summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2013-09-11 21:09:43 -0500
committerEric Haszlakiewicz <erh+git@nimenees.com>2013-09-11 21:09:43 -0500
commit06450206c4f3de4af8d81bb6d93e9db1d5fedec1 (patch)
tree853805d441de87d3b529b9b8e657eed8d45908f7
parenta23caf677c107b7cfe5ad52c73a932c706aaa7f5 (diff)
downloadjson-c-06450206c4f3de4af8d81bb6d93e9db1d5fedec1.tar.gz
Issue #59: change the floating point output format to %.17g so values with more than 6 digits show up in the output.
-rw-r--r--json_object.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/json_object.c b/json_object.c
index 118def7..faf6193 100644
--- a/json_object.c
+++ b/json_object.c
@@ -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) {