From fb9acd28bf86f800d4dcd2fa20912fd5beadbe10 Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Fri, 10 Nov 2023 07:29:26 +0800 Subject: [PATCH] fix: accuracy loss when convert float to string --- src/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.cpp b/src/utils.cpp index 0b28898..376d6ff 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -55,7 +55,7 @@ std::string Any2String(const std::any &value) { std::stringstream buf; std::string res; if (auto ptr = std::any_cast(&value)) { - buf << std::setiosflags(std::ios::fixed) << std::setprecision(15) << *ptr; + buf << std::fixed << std::setprecision(310) << *ptr; } else if (auto ptr = std::any_cast(&value)) { if (*ptr) buf << "True";