summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/toml++/impl/toml_formatter.inl2
-rw-r--r--toml.hpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/toml++/impl/toml_formatter.inl b/include/toml++/impl/toml_formatter.inl
index 201de9ce9e..8b4f633dca 100644
--- a/include/toml++/impl/toml_formatter.inl
+++ b/include/toml++/impl/toml_formatter.inl
@@ -91,7 +91,7 @@ TOML_ANON_NAMESPACE_START
weight += 1u;
val *= -1.0;
}
- return weight + static_cast<size_t>(log10(val)) + 1u;
+ return weight + static_cast<size_t>(abs(log10(val))) + 1u;
}
case node_type::boolean: return 5u;
diff --git a/toml.hpp b/toml.hpp
index ef3515b136..8fe1a0d5b8 100644
--- a/toml.hpp
+++ b/toml.hpp
@@ -17107,7 +17107,7 @@ TOML_ANON_NAMESPACE_START
weight += 1u;
val *= -1.0;
}
- return weight + static_cast<size_t>(log10(val)) + 1u;
+ return weight + static_cast<size_t>(abs(log10(val))) + 1u;
}
case node_type::boolean: return 5u;