Skip to content

Commit 638ad26

Browse files
BillyDonahuecdunn2001
authored andcommitted
Explicitly specify hexfloat in TestResult operator<< (open-source-parsers#1078)
1 parent ec9302c commit 638ad26

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/test_lib_json/jsontest.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <cstdio>
1010
#include <deque>
11+
#include <iomanip>
1112
#include <json/config.h>
1213
#include <json/value.h>
1314
#include <json/writer.h>
@@ -83,9 +84,7 @@ class TestResult {
8384
// Generic operator that will work with anything ostream can deal with.
8485
template <typename T> TestResult& operator<<(const T& value) {
8586
Json::OStringStream oss;
86-
oss.precision(16);
87-
oss.setf(std::ios_base::floatfield);
88-
oss << value;
87+
oss << std::setprecision(16) << std::hexfloat << value;
8988
return addToLastFailure(oss.str());
9089
}
9190

0 commit comments

Comments
 (0)