Github user mygityf commented on the pull request: https://github.com/apache/thrift/pull/864#issuecomment-184034288 The precision is 15 bits after dot of format casting from double to string in Thrift-cpp-library- json-protocol. But the precision is 16 bits after dot in Thrift-lua-library-json-protocol. So, test with C++ server is break. @nsuke can we modify the precision to 16 bits for C++ server? The solution: To Change code 'str.precision(std::numeric_limits<double>::digits10 + 1);' to 'str.precision(std::numeric_limits<double>::digits10 + 2);' in function doubeToString file TJSONProtocol.cpp at line 524, e.g: before: In C++ TJsonProtocol.cpp: double a = 1.12345678906666663; string astr = doubleToString(a); double b = stringToDouble(astr); the result as below: a = 1.1234567890666667 astr = "1.123456789066667" b = 1.1234567890666669 after changing: the result as below: a = 1.1234567890666667 astr = "1.1234567890666667" b = 1.1234567890666667 This result is expected.
--- 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. ---