|
|
@ -508,6 +508,7 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out |
|
|
|
length = sprintf((char *)number_buffer, "%llu", (long long)d); |
|
|
|
/* Try 8 decimal places of precision to avoid nonsignificant nonzero digits */ |
|
|
|
else length = sprintf((char *)number_buffer, "%0.8f", d); |
|
|
|
printf("d A -> (%s)\n",number_buffer); |
|
|
|
|
|
|
|
/* Check whether the original double can be recovered */ |
|
|
|
if ((sscanf((char *)number_buffer, "%lg", &test) != 1) || ((double)test != d)) |
|
|
@ -516,6 +517,7 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out |
|
|
|
length = sprintf((char *)number_buffer, "%llu", (long long)d); |
|
|
|
/* If not, print with 8 decimal places of precision */ |
|
|
|
else length = sprintf((char *)number_buffer, "%0.8f", d); |
|
|
|
printf("d B -> (%s)\n",number_buffer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|