Preserve floating point precision in JSON output.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Fri, 15 Apr 2011 22:49:16 +0000 (23:49 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Fri, 15 Apr 2011 22:49:16 +0000 (23:49 +0100)
json.hpp

index ee2a9e0..24d9c87 100644 (file)
--- a/json.hpp
+++ b/json.hpp
@@ -295,7 +295,7 @@ public:
     template<class T>
     inline void writeNumber(T n) {
         separator();
-        os << std::dec << n;
+        os << std::dec << std::setprecision(9) << n;
         value = true;
         space = ' ';
     }