Github user hcorg commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/870#discussion_r52925705
  
    --- Diff: lib/cpp/src/thrift/protocol/TJSONProtocol.cpp ---
    @@ -524,7 +524,8 @@ namespace {
     std::string doubleToString(double d) {
       std::ostringstream str;
       str.imbue(std::locale::classic());
    -  str.precision(std::numeric_limits<double>::digits10 + 1);
    +  // new precision is 17 equal to max_digits10(c++11) or digits10+2
    +  str.precision(17);
    --- End diff --
    
    IMHO
    `const double max_digits10 = 2 + std::numeric_limits<double>::digits10;`
    `str.precision(max_digits10);`
    looks better than comment ;)
    
    I'd even consider naming variable `max_digits10_cpp11`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to