Reputation: 15357
I have the following function fragments:
bool A_AbstractTester_Actor::Equals( int lineNumber, T_String valueText, double value, T_String expectedText, double expected, double accuracy )
{
...
v_FailedText << std::setprecision(8) << "\nLine " << lineNumber
<< ": EQUALS_DOUBLE FAILED, Value '" << valueText << "' (" << value
<< "), Expected '" << expectedText << "' (" << expected << ")\n";
Later I print v_FailedText and the result is:
Line 242: EQUALS_DOUBLE_FAILED, Value 'step' (0), Expected '1.0' (1)
What I expected was :
Line 242: EQUALS_DOUBLE_FAILED, Value 'step' (0.00000000), Expected '1.0' (1.00000000)
Upvotes: 1
Views: 48
Reputation: 55887
You should use std::fixed manipulator.
bool A_AbstractTester_Actor::Equals( int lineNumber, T_String valueText, double value, T_String expectedText, double expected, double accuracy )
{
...
v_FailedText << std::fixed << std::setprecision(8) "\nLine " << lineNumber
<< ": EQUALS_DOUBLE FAILED, Value '" << valueText << "' (" << value
<< "), Expected '" << expectedText << "' (" << expected << ")\n";
Upvotes: 2