]> git.cworth.org Git - apitrace/blobdiff - common/trace_dump.cpp
Use appropriate number of digits when dumping floating point numbers.
[apitrace] / common / trace_dump.cpp
index d9dcf1197737a7d1a2033fc463d0b20edfc27842..2b8c27a3780b28f57bb4ddad5ba14aebac9cdc97 100644 (file)
@@ -24,6 +24,8 @@
  **************************************************************************/
 
 
+#include <limits>
+
 #include "formatter.hpp"
 #include "trace_dump.hpp"
 
@@ -89,11 +91,15 @@ public:
     }
 
     void visit(Float *node) {
+        std::streamsize oldPrecision = os.precision(std::numeric_limits<float>::digits10 + 1);
         os << literal << node->value << normal;
+        os.precision(oldPrecision);
     }
 
     void visit(Double *node) {
+        std::streamsize oldPrecision = os.precision(std::numeric_limits<double>::digits10 + 1);
         os << literal << node->value << normal;
+        os.precision(oldPrecision);
     }
 
     void visit(String *node) {