Skip to content

Commit 1d3c4fa

Browse files
committed
fixed #13606/13607 - print (precise) float as such in ValueFlow debug output [skip ci]
1 parent 4e59e90 commit 1d3c4fa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: lib/token.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,7 @@ void Token::printValueFlow(bool xml, std::ostream &out) const
17901790
break;
17911791
case ValueFlow::Value::ValueType::FLOAT:
17921792
outs += "floatvalue=\"";
1793-
outs += std::to_string(value.floatValue); // TODO: should this be MathLib::toString()?
1793+
outs += MathLib::toString(value.floatValue);
17941794
outs += '\"';
17951795
break;
17961796
case ValueFlow::Value::ValueType::MOVED:
@@ -1864,7 +1864,6 @@ void Token::printValueFlow(bool xml, std::ostream &out) const
18641864

18651865
outs += "/>\n";
18661866
}
1867-
18681867
else {
18691868
if (&value != &values->front())
18701869
outs += ",";

Diff for: lib/vfvalue.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "vfvalue.h"
2020

2121
#include "errortypes.h"
22+
#include "mathlib.h"
2223
#include "token.h"
2324

2425
#include <sstream>
@@ -58,7 +59,7 @@ namespace ValueFlow {
5859
ss << this->tokvalue->str();
5960
break;
6061
case ValueType::FLOAT:
61-
ss << this->floatValue;
62+
ss << MathLib::toString(this->floatValue);
6263
break;
6364
case ValueType::MOVED:
6465
ss << toString(this->moveKind);

0 commit comments

Comments
 (0)