GitHub user mygityf opened a pull request: https://github.com/apache/thrift/pull/948
THRIFT-3744 The precision should be 17 (16 bits need after dot) after dot for double type. The precision is lost when converting double to string. E.g: double PI = 3.1415926535897931; string value = format("%.16g", PI); The value will be '3.141592653589793' and last 1 is lost after format operation. But expected value should be '3.1415926535897931'. Solution: string value = format("%.17g", PI); You can merge this pull request into a Git repository by running: $ git pull https://github.com/gityf/thrift double-precision-17-bits Alternatively you can review and apply these changes as the patch at: https://github.com/apache/thrift/pull/948.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #948 ---- commit 5a2b9cd39f6088dc5ccc726e7c0d483c5d7470ee Author: Wang Yaofu <voip...@sina.cn> Date: 2016-03-15T01:54:21Z THRIFT-3744 The precision should be 17 (16 bits need after dot) after dot for double type. The precision is lost when converting double to string. E.g: double PI = 3.1415926535897931; string value = format("%.16g", PI); The value will be '3.141592653589793' and last 1 is lost after format operation. But expected value should be '3.1415926535897931'. Solution: string value = format("%.17g", PI); ---- --- 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. ---