title: Rounding a double type with RapidJSON
body: <p>I'm using RapidJSON (<a href="https://github.com/miloyip/rapidjson" rel="nofollow noreferrer">https://github.com/miloyip/rapidjson</a>) to create quite big arrays (~ 5 MB) and a lot of the space is waste due to too accurate floating point numbers.
  E.g.</p>
  
  <pre><code>StringBuffer s;
  Writer&lt;StringBuffer&gt; writer(s);
  writer.StartObject();
  writer.String("value");
  writer.Double(1.0/3.0);
  writer.EndObject();
  </code></pre>
  
  <p>This results in a json "{'value': 0.33333333333}" which is very annoying when I only need a few significant numbers.</p>
  
  <p>I found a solution <a href="https://stackoverflow.com/questions/16104558/set-floating-point-precision-using-rapidjson">Set floating point precision using rapidjson</a> in this post, but it's already a few years old and outdated with the latest rapidjson build. Has anyone got a solution for this?</p>