[ https://issues.apache.org/jira/browse/THRIFT-3636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15148179#comment-15148179 ]
Hudson commented on THRIFT-3636: -------------------------------- SUCCESS: Integrated in Thrift-precommit #160 (See [https://builds.apache.org/job/Thrift-precommit/160/]) THRIFT-3636 The precision is 15 bits after dot of casting from double to (voipman: [https://github.com/apache/thrift/commit/93f0c9836dbcbb9564413c3f4a20e85799cafb7d]) * lib/cpp/src/thrift/protocol/TJSONProtocol.cpp THRIFT-3636 The precision is 15 bits after dot of casting from double to (voipman: [https://github.com/apache/thrift/commit/e0bebd14f9df02d31603506b72eb5dbcfea74ce6]) * lib/cpp/src/thrift/protocol/TJSONProtocol.cpp THRIFT-3636 The precision is 15 bits after dot of casting from double to (voipman: [https://github.com/apache/thrift/commit/6e7154784a935076109bb7c3dddc777162f55a09]) * lib/cpp/src/thrift/protocol/TJSONProtocol.cpp THRIFT-3636 The precision is 15 bits after dot of casting from double to (voipman: [https://github.com/apache/thrift/commit/d1bc9c555fcf06e382c26661f658fdd631aba4df]) * lib/cpp/src/thrift/protocol/TJSONProtocol.cpp THRIFT-3636 The precision is 15 bits after dot of casting from double to (voipman: [https://github.com/apache/thrift/commit/4f2e785f5bd71f360a435f7f4cbfa8dbf1e0fd2d]) * lib/cpp/test/JSONProtoTest.cpp THRIFT-3636 The precision is 15 bits after dot of casting from double to (voipman: [https://github.com/apache/thrift/commit/86d340bde476e13f1bbceb3887e67e552edc5dc8]) * lib/cpp/test/JSONProtoTest.cpp THRIFT-3636 The precision is 15 bits after dot of casting from double to (voipman: [https://github.com/apache/thrift/commit/1624e7c95b32a8b507b726d2086b5cb7c746c814]) * lib/cpp/test/JSONProtoTest.cpp > The precision is 15 bits after dot of casting from double to string in > Thrift-cpp-library- json-protocol. > --------------------------------------------------------------------------------------------------------- > > Key: THRIFT-3636 > URL: https://issues.apache.org/jira/browse/THRIFT-3636 > Project: Thrift > Issue Type: Bug > Components: C++ - Library > Affects Versions: 0.9.3 > Environment: Linux Mac Windows > Reporter: WangYaofu > Assignee: WangYaofu > Fix For: 0.9.4 > > > The precision is 15 bits after dot of format casting from double to string in > Thrift-cpp-library- json-protocol. > But the expected precision is 16 bits after dot in Thrift-json-protocol. > 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. -- This message was sent by Atlassian JIRA (v6.3.4#6332)