[ 
https://issues.apache.org/jira/browse/THRIFT-3745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15194602#comment-15194602
 ] 

ASF GitHub Bot commented on THRIFT-3745:
----------------------------------------

GitHub user mygityf opened a pull request:

    https://github.com/apache/thrift/pull/949

    THRIFT-3745 The precision should be 17 for double

    $num= 3.1415926535897931;
    $this->trans_->write(json_encode($num)); 
    The value will be '3.1415926535898' and some precision lost after format 
operation.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gityf/thrift PHP-double-precision-17-bits

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/949.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 #949
    
----
commit 77b8fb3fedeaf0cf030fd8e6afc7808fca408513
Author: Wang Yaofu <[email protected]>
Date:   2016-03-15T02:25:33Z

    THRIFT-3745 The precision should be 17 for double
    
    $num= 3.1415926535897931;
    $this->trans_->write(json_encode($num)); 
    The value will be '3.1415926535898' and some precision lost after format 
operation.

----


> The precision should be 17 for double
> -------------------------------------
>
>                 Key: THRIFT-3745
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3745
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.9.3
>            Reporter: WangYaofu
>            Assignee: WangYaofu
>             Fix For: 0.10.0
>
>
> The precision is lost when converting double to string.
>     E.g:
>     $num= 3.1415926535897931;
>     $this->trans_->write(json_encode($num));    
>     The value will be '3.1415926535898' and some precision lost after format 
> operation.
>     But expected value should be '3.1415926535897931'.
>     Solution:
>     ini_set("precision",17);
>     $this->trans_->write(json_encode($num));



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to