Fix regression due to float printing changes

Trac #12501 This was caused by the change from printf to iostream printing. Sets the float formatting to "default" which is neither fixed or scientific and request 8 digits of precision. This appears to be mostly equivalent to the previous "%.8g". If the non-fractional case, we set it to fixed and use 1 unit of precision after the decimal. Signed-off-by: Andrew Lewycky Signed-off-by: Shannon Woods Signed-off-by: Ken Russell git-svn-id: https://angleproject.googlecode.com/svn/trunk@331 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent fce644e2
...@@ -72,9 +72,12 @@ public: ...@@ -72,9 +72,12 @@ public:
// the compiler. // the compiler.
TPersistStringStream stream; TPersistStringStream stream;
if (fractionalPart(f) == 0.0f) { if (fractionalPart(f) == 0.0f) {
stream.precision(2); stream.precision(1);
stream << std::showpoint << f; stream << std::showpoint << std::fixed << f;
} else { } else {
stream.unsetf(std::ios::fixed);
stream.unsetf(std::ios::scientific);
stream.precision(8);
stream << f; stream << f;
} }
sink.append(stream.str()); sink.append(stream.str());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment