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
diff --git a/src/compiler/InfoSink.h b/src/compiler/InfoSink.h
index 5c25c03..4762778 100644
--- a/src/compiler/InfoSink.h
+++ b/src/compiler/InfoSink.h
@@ -72,9 +72,12 @@
// the compiler.
TPersistStringStream stream;
if (fractionalPart(f) == 0.0f) {
- stream.precision(2);
- stream << std::showpoint << f;
+ stream.precision(1);
+ stream << std::showpoint << std::fixed << f;
} else {
+ stream.unsetf(std::ios::fixed);
+ stream.unsetf(std::ios::scientific);
+ stream.precision(8);
stream << f;
}
sink.append(stream.str());