From 851c116a2db83da028f63f48e3723c0e1b2fb71a Mon Sep 17 00:00:00 2001 From: ihakh <45719816+ihakh@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:37:26 +0330 Subject: [PATCH] fix JSON_REAL_PRECISION there is a bug in precision https://stackoverflow.com/questions/31274738/how-to-specify-number-of-digits-to-output-for-real-numbers-in-jansson --- src/strconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strconv.c b/src/strconv.c index 9e202c5c..37cb4146 100644 --- a/src/strconv.c +++ b/src/strconv.c @@ -72,7 +72,7 @@ int jsonp_dtostr(char *buffer, size_t size, double value, int precision) { */ char digits[25]; char *digits_end; - int mode = precision == 0 ? 0 : 2; + int mode = precision == 0 ? 0 : 5; int decpt, sign, exp_len, exp = 0, use_exp = 0; int digits_len, vdigits_start, vdigits_end; char *p;