Skip to content

Commit

Permalink
fixed #13606/13607 - print (precise) float as such in ValueFlow debug…
Browse files Browse the repository at this point in the history
… output [skip ci]
  • Loading branch information
firewave committed Feb 6, 2025
1 parent fcda2d1 commit ca7d387
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -1875,7 +1876,6 @@ void Token::printValueFlow(bool xml, std::ostream &out) const

outs += "/>\n";
}

else {
if (&value != &values->front())
outs += ",";
Expand Down
3 changes: 2 additions & 1 deletion lib/vfvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "vfvalue.h"

#include "errortypes.h"
#include "mathlib.h"
#include "token.h"

#include <sstream>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ca7d387

Please sign in to comment.