From 6bdbada8e7580c4f90628ccb0e9356a2206bfb87 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Fri, 30 Sep 2022 18:49:15 +0200 Subject: [PATCH] fix bug --- include/util/json_renderer.hpp | 51 +++++++++++++++++----------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/include/util/json_renderer.hpp b/include/util/json_renderer.hpp index b717ffc8547..f81d2b9cc3a 100644 --- a/include/util/json_renderer.hpp +++ b/include/util/json_renderer.hpp @@ -54,31 +54,32 @@ template struct Renderer void operator()(const Number &number) { - char buffer[MAX_FLOAT_STRING_LENGTH] = {'\0'}; - ieee754::dtoa_milo(number.value, buffer); - - // Trucate to 10 decimal places - int pos = 0; - int decimalpos = 0; - while (decimalpos == 0 && pos < MAX_FLOAT_STRING_LENGTH && buffer[pos] != 0) - { - if (buffer[pos] == '.') - { - decimalpos = pos; - break; - } - ++pos; - } - while (pos < MAX_FLOAT_STRING_LENGTH && buffer[pos] != 0) - { - if (pos - decimalpos == 10) - { - buffer[pos] = '\0'; - break; - } - ++pos; - } - write(buffer); + // char buffer[MAX_FLOAT_STRING_LENGTH] = {'\0'}; + // ieee754::dtoa_milo(number.value, buffer); + + // // Trucate to 10 decimal places + // int pos = 0; + // int decimalpos = 0; + // while (decimalpos == 0 && pos < MAX_FLOAT_STRING_LENGTH && buffer[pos] != 0) + // { + // if (buffer[pos] == '.') + // { + // decimalpos = pos; + // break; + // } + // ++pos; + // } + // while (pos < MAX_FLOAT_STRING_LENGTH && buffer[pos] != 0) + // { + // if (pos - decimalpos == 10) + // { + // buffer[pos] = '\0'; + // break; + // } + // ++pos; + // } + const std::string number_string = cast::to_string_with_precision(number.value); + write(number_string); } void operator()(const Object &object)