Closed
Description
TestResult operator<< uses
oss.setf(std::ios_base::floatfield);
This is inappropriate. The ios_base::floatfield is a mask, not a value.
This essentially selects hexfloat output, but if we wanted to do that we should do it explicitly.
Reproduce
This essentially what our TestResult operator is doing:
https://gcc.godbolt.org/z/e93L45
#include <iostream>
int main() {
std::cout.setf(std::ios_base::floatfield);
std::cout << "f:" << 3.14 << std::endl;
}
Output:
f:0x1.91eb851eb851fp+1
Expected behavior
I think we didn't want hexfloat output, or we would have asked for it by name.
I'm guessing the intent was to clear the floatfield, and we do that with unsetf
.
None of our unit tests actually call operator<< with a floating point value, so it never mattered. We should fix the bug anyway.
Metadata
Metadata
Assignees
Labels
No labels