fix: accuracy loss when convert float to string
This commit is contained in:
@ -55,7 +55,7 @@ std::string Any2String(const std::any &value) {
|
|||||||
std::stringstream buf;
|
std::stringstream buf;
|
||||||
std::string res;
|
std::string res;
|
||||||
if (auto ptr = std::any_cast<double>(&value)) {
|
if (auto ptr = std::any_cast<double>(&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<bool>(&value)) {
|
} else if (auto ptr = std::any_cast<bool>(&value)) {
|
||||||
if (*ptr)
|
if (*ptr)
|
||||||
buf << "True";
|
buf << "True";
|
||||||
|
Reference in New Issue
Block a user