Fixed json/toml float precision on write

This commit is contained in:
MihailRis
2023-12-03 04:27:45 +03:00
parent 209acd257c
commit f47882194c
2 changed files with 8 additions and 1 deletions
+3
View File
@@ -2,6 +2,7 @@
#include <math.h>
#include <sstream>
#include <iomanip>
#include <memory>
#include "commons.h"
@@ -70,6 +71,8 @@ void stringify(Value* value,
} else if (value->type == valtype::boolean) {
ss << (value->value.boolean ? "true" : "false");
} else if (value->type == valtype::number) {
ss << std::fixed;
ss << std::setprecision(15);
ss << value->value.decimal;
} else if (value->type == valtype::integer) {
ss << value->value.integer;