diff --git a/lib/token.cpp b/lib/token.cpp index 7c7d7a278a9..9243c01aa81 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -21,6 +21,7 @@ #include "astutils.h" #include "errortypes.h" #include "library.h" +#include "mathlib.h" #include "settings.h" #include "simplecpp.h" #include "symboldatabase.h" @@ -1801,7 +1802,7 @@ void Token::printValueFlow(bool xml, std::ostream &out) const break; case ValueFlow::Value::ValueType::FLOAT: outs += "floatvalue=\""; - outs += std::to_string(value.floatValue); // TODO: should this be MathLib::toString()? + outs += MathLib::toString(value.floatValue); outs += '\"'; break; case ValueFlow::Value::ValueType::MOVED: @@ -1875,7 +1876,6 @@ void Token::printValueFlow(bool xml, std::ostream &out) const outs += "/>\n"; } - else { if (&value != &values->front()) outs += ","; diff --git a/lib/vfvalue.cpp b/lib/vfvalue.cpp index 8e694c6eeb7..9dd1d423faa 100644 --- a/lib/vfvalue.cpp +++ b/lib/vfvalue.cpp @@ -19,6 +19,7 @@ #include "vfvalue.h" #include "errortypes.h" +#include "mathlib.h" #include "token.h" #include @@ -58,7 +59,7 @@ namespace ValueFlow { ss << this->tokvalue->str(); break; case ValueType::FLOAT: - ss << this->floatValue; + ss << MathLib::toString(this->floatValue); break; case ValueType::MOVED: ss << toString(this->moveKind);