Skip to content

Commit ca7d387

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

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/token.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "astutils.h"
2222
#include "errortypes.h"
2323
#include "library.h"
24+
#include "mathlib.h"
2425
#include "settings.h"
2526
#include "simplecpp.h"
2627
#include "symboldatabase.h"
@@ -1801,7 +1802,7 @@ void Token::printValueFlow(bool xml, std::ostream &out) const
18011802
break;
18021803
case ValueFlow::Value::ValueType::FLOAT:
18031804
outs += "floatvalue=\"";
1804-
outs += std::to_string(value.floatValue); // TODO: should this be MathLib::toString()?
1805+
outs += MathLib::toString(value.floatValue);
18051806
outs += '\"';
18061807
break;
18071808
case ValueFlow::Value::ValueType::MOVED:
@@ -1875,7 +1876,6 @@ void Token::printValueFlow(bool xml, std::ostream &out) const
18751876

18761877
outs += "/>\n";
18771878
}
1878-
18791879
else {
18801880
if (&value != &values->front())
18811881
outs += ",";

lib/vfvalue.cpp

Lines changed: 2 additions & 1 deletion
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)