Skip to content

Commit 1ee82af

Browse files
committed
fixed #13607 - print float values as such in valueflow debug output
1 parent c6cfb00 commit 1ee82af

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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);

Diff for: test/cli/other_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3072,12 +3072,12 @@ def test_debug_valueflow(tmp_path):
30723072
'##Value flow',
30733073
'File {}'.format(test_file),
30743074
'Line 3',
3075-
' = always 2',
3076-
' 1.0 always 1',
3077-
' / always 2',
3075+
' = always 2.0',
3076+
' 1.0 always 1.0',
3077+
' / always 2.0',
30783078
' 0.5 always 0.5',
30793079
'Line 4',
3080-
' d always {symbolic=(1.0/0.5),2}'
3080+
' d always {symbolic=(1.0/0.5),2.0}'
30813081
]
30823082

30833083

0 commit comments

Comments
 (0)