{"action":"created","comment":{"url":"https://api.github.com/repos/php/php-src/pulls/comments/36456617","id":36456617,"diff_hunk":"@@ -104,7 +104,11 @@ static inline void php_json_encode_double(smart_str *buf, double d, int options)\n {\n \tsize_t len;\n \tchar num[PHP_JSON_DOUBLE_MAX_LENGTH];\n-\tphp_gcvt(d, (int)EG(precision), '.', 'e', &num[0]);\n+\tif (JSON_G(precision) == -1) {\n+\t\tphp_0cvt(d, 17, '.', 'e', num);\n+\t} else {\n+\t\tphp_gcvt(d, JSON_G(precision), '.', 'e', num);\n+\t}","path":"ext/json/json_encoder.c","position":9,"original_position":9,"commit_id":"08ac858676daa0b2e4e6ec2b58d3d689403db41f","original_commit_id":"08ac858676daa0b2e4e6ec2b58d3d689403db41f","user":{"login":"bukka","id":137594,"avatar_url":"https://avatars.githubusercontent.com/u/137594?v=3","gravatar_id":"","url":"https://api.github.com/users/bukka","html_url":"https://github.com/bukka","followers_url":"https://api.github.com/users/bukka/followers","following_url":"https://api.github.com/users/bukka/following{/other_user}","gists_url":"https://api.github.com/users/bukka/gists{/gist_id}","starred_url":"https://api.github.com/users/bukka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bukka/subscriptions","organizations_url":"https://api.github.com/users/bukka/orgs","repos_url":"https://api.github.com/users/bukka/repos","events_url":"https://api.github.com/users/bukka/events{/privacy}","received_events_url":"https://api.github.com/users/bukka/received_events","type":"User","site_admin":false},"body":"Actually I was wrong and didn't look to php_gcvt properly (I just check zend_dtoa). It uses ndigits for selecting if the number should be printed in E-style so it's important:\r\n\r\nhttps://github.com/php/php-src/blob/f6d196a38f484603452ca0ffaa241940c452ac99/main/snprintf.c#L163\r\n\r\nI'm not sure that we should ignore that and also not sure if (-1) is a good way how to change mode because it means disallowing precision setting (selecting when the E-style is used). Maybe something like ini \"serialization_precision_mode\" would be better but it's maybe too many ini settings...","created_at":"2015-08-06T19:42:08Z","updated_at":"2015-08-06T19:42:08Z","html_url":"https://github.com/php/php-src/pull/1455#discussion_r36456617","pull_request_url":"https://api.github.com/repos/php/php-src/pulls/1455","_links":{"self":{"href":"https://api.github.com/repos/php/php-src/pulls/comments/36456617"},"html":{"href":"https://github.com/php/php-src/pull/1455#discussion_r36456617"},"pull_request":{"href":"https://api.github.com/repos/php/php-src/pulls/1455"}}},"pull_request":{"url":"https://api.github.com/repos/php/php-src/pulls/1455","id":41628852,"html_url":"https://github.com/php/php-src/pull/1455","diff_url":"https://github.com/php/php-src/pull/1455.diff","patch_url":"https://github.com/php/php-src/pull/1455.patch","issue_url":"https://api.github.com/repos/php/php-src/issues/1455","number":1455,"state":"open","locked":false,"title":"PHP RFC: More precise float value handling","user":{"login":"yohgaki","id":118485,"avatar_url":"https://avatars.githubusercontent.com/u/118485?v=3","gravatar_id":"","url":"https://api.github.com/users/yohgaki","html_url":"https://github.com/yohgaki","followers_url":"https://api.github.com/users/yohgaki/followers","following_url":"https://api.github.com/users/yohgaki/following{/other_user}","gists_url":"https://api.github.com/users/yohgaki/gists{/gist_id}","starred_url":"https://api.github.com/users/yohgaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yohgaki/subscriptions","organizations_url":"https://api.github.com/users/yohgaki/orgs","repos_url":"https://api.github.com/users/yohgaki/repos","events_url":"https://api.github.com/users/yohgaki/events{/privacy}","received_events_url":"https://api.github.com/users/yohgaki/received_events","type":"User","site_admin":false},"body":"PHP RFC: More precise float value handling\r\nhttps://wiki.php.net/rfc/precise_float_value\r\n\r\nMagic number is better to be defined in a .h\r\nAny suggestions?\r\n\r\nTODO: Add/modify tests.  Add PG(precision) 0 mode. Use PG(serialize_precision) for WDDX/XMLRPC.\r\n\r\nHow it works:\r\n\r\n*OLD Behavior:*\r\n```\r\nMacBook-Pro:github-php-src yohgaki$ ./php-bin -d serialize_precision=17 -r '$a=[\"v\"=>123450000000000000000000000000.1234567890123]; var_dump(json_encode($a), serialize($a), var_export($a, true));';\r\nstring(28) \"{\"v\":1.2344999999999999e+29}\"\r\nstring(39) \"a:1:{s:1:\"v\";d:1.2344999999999999E+29;}\"\r\nstring(42) \"array (\r\n  'v' => 1.2344999999999999E+29,\r\n)\"\r\n```\r\n\r\n*NEW Behavior:*\r\n```\r\nMacBook-Pro:github-php-src yohgaki$ ./php-bin -r '$a=[\"v\"=>123450000000000000000000000000.1234567890123]; var_dump(json_encode($a), serialize($a), var_export($a, true));';\r\nstring(16) \"{\"v\":1.2345e+29}\"\r\nstring(27) \"a:1:{s:1:\"v\";d:1.2345E+29;}\"\r\nstring(30) \"array (\r\n  'v' => 1.2345E+29,\r\n)\"\r\n```\r\n","created_at":"2015-08-04T23:20:46Z","updated_at":"2015-08-06T19:42:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41cbd0817f4c657bf09069e96641eb3608878028","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/php/php-src/pulls/1455/commits","review_comments_url":"https://api.github.com/repos/php/php-src/pulls/1455/comments","review_comment_url":"https://api.github.com/repos/php/php-src/pulls/comments{/number}","comments_url":"https://api.github.com/repos/php/php-src/issues/1455/comments","statuses_url":"https://api.github.com/repos/php/php-src/statuses/08ac858676daa0b2e4e6ec2b58d3d689403db41f","head":{"label":"yohgaki:master-precise-float","ref":"master-precise-float","sha":"08ac858676daa0b2e4e6ec2b58d3d689403db41f","user":{"login":"yohgaki","id":118485,"avatar_url":"https://avatars.githubusercontent.com/u/118485?v=3","gravatar_id":"","url":"https://api.github.com/users/yohgaki","html_url":"https://github.com/yohgaki","followers_url":"https://api.github.com/users/yohgaki/followers","following_url":"https://api.github.com/users/yohgaki/following{/other_user}","gists_url":"https://api.github.com/users/yohgaki/gists{/gist_id}","starred_url":"https://api.github.com/users/yohgaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yohgaki/subscriptions","organizations_url":"https://api.github.com/users/yohgaki/orgs","repos_url":"https://api.github.com/users/yohgaki/repos","events_url":"https://api.github.com/users/yohgaki/events{/privacy}","received_events_url":"https://api.github.com/users/yohgaki/received_events","type":"User","site_admin":false},"repo":{"id":7073776,"name":"php-src","full_name":"yohgaki/php-src","owner":{"login":"yohgaki","id":118485,"avatar_url":"https://avatars.githubusercontent.com/u/118485?v=3","gravatar_id":"","url":"https://api.github.com/users/yohgaki","html_url":"https://github.com/yohgaki","followers_url":"https://api.github.com/users/yohgaki/followers","following_url":"https://api.github.com/users/yohgaki/following{/other_user}","gists_url":"https://api.github.com/users/yohgaki/gists{/gist_id}","starred_url":"https://api.github.com/users/yohgaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yohgaki/subscriptions","organizations_url":"https://api.github.com/users/yohgaki/orgs","repos_url":"https://api.github.com/users/yohgaki/repos","events_url":"https://api.github.com/users/yohgaki/events{/privacy}","received_events_url":"https://api.github.com/users/yohgaki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yohgaki/php-src","description":"The PHP Interpreter","fork":true,"url":"https://api.github.com/repos/yohgaki/php-src","forks_url":"https://api.github.com/repos/yohgaki/php-src/forks","keys_url":"https://api.github.com/repos/yohgaki/php-src/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yohgaki/php-src/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yohgaki/php-src/teams","hooks_url":"https://api.github.com/repos/yohgaki/php-src/hooks","issue_events_url":"https://api.github.com/repos/yohgaki/php-src/issues/events{/number}","events_url":"https://api.github.com/repos/yohgaki/php-src/events","assignees_url":"https://api.github.com/repos/yohgaki/php-src/assignees{/user}","branches_url":"https://api.github.com/repos/yohgaki/php-src/branches{/branch}","tags_url":"https://api.github.com/repos/yohgaki/php-src/tags","blobs_url":"https://api.github.com/repos/yohgaki/php-src/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yohgaki/php-src/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yohgaki/php-src/git/refs{/sha}","trees_url":"https://api.github.com/repos/yohgaki/php-src/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yohgaki/php-src/statuses/{sha}","languages_url":"https://api.github.com/repos/yohgaki/php-src/languages","stargazers_url":"https://api.github.com/repos/yohgaki/php-src/stargazers","contributors_url":"https://api.github.com/repos/yohgaki/php-src/contributors","subscribers_url":"https://api.github.com/repos/yohgaki/php-src/subscribers","subscription_url":"https://api.github.com/repos/yohgaki/php-src/subscription","commits_url":"https://api.github.com/repos/yohgaki/php-src/commits{/sha}","git_commits_url":"https://api.github.com/repos/yohgaki/php-src/git/commits{/sha}","comments_url":"https://api.github.com/repos/yohgaki/php-src/comments{/number}","issue_comment_url":"https://api.github.com/repos/yohgaki/php-src/issues/comments{/number}","contents_url":"https://api.github.com/repos/yohgaki/php-src/contents/{+path}","compare_url":"https://api.github.com/repos/yohgaki/php-src/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yohgaki/php-src/merges","archive_url":"https://api.github.com/repos/yohgaki/php-src/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yohgaki/php-src/downloads","issues_url":"https://api.github.com/repos/yohgaki/php-src/issues{/number}","pulls_url":"https://api.github.com/repos/yohgaki/php-src/pulls{/number}","milestones_url":"https://api.github.com/repos/yohgaki/php-src/milestones{/number}","notifications_url":"https://api.github.com/repos/yohgaki/php-src/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yohgaki/php-src/labels{/name}","releases_url":"https://api.github.com/repos/yohgaki/php-src/releases{/id}","created_at":"2012-12-09T00:14:22Z","updated_at":"2015-04-24T02:42:33Z","pushed_at":"2015-08-05T05:36:44Z","git_url":"git://github.com/yohgaki/php-src.git","ssh_url":"git@github.com:yohgaki/php-src.git","clone_url":"https://github.com/yohgaki/php-src.git","svn_url":"https://github.com/yohgaki/php-src","homepage":"http://www.php.net","size":247066,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"php:master","ref":"master","sha":"668ecaa606b3203311b3329fcbd49b59f715e1e4","user":{"login":"php","id":25158,"avatar_url":"https://avatars.githubusercontent.com/u/25158?v=3","gravatar_id":"","url":"https://api.github.com/users/php","html_url":"https://github.com/php","followers_url":"https://api.github.com/users/php/followers","following_url":"https://api.github.com/users/php/following{/other_user}","gists_url":"https://api.github.com/users/php/gists{/gist_id}","starred_url":"https://api.github.com/users/php/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php/subscriptions","organizations_url":"https://api.github.com/users/php/orgs","repos_url":"https://api.github.com/users/php/repos","events_url":"https://api.github.com/users/php/events{/privacy}","received_events_url":"https://api.github.com/users/php/received_events","type":"Organization","site_admin":false},"repo":{"id":1903522,"name":"php-src","full_name":"php/php-src","owner":{"login":"php","id":25158,"avatar_url":"https://avatars.githubusercontent.com/u/25158?v=3","gravatar_id":"","url":"https://api.github.com/users/php","html_url":"https://github.com/php","followers_url":"https://api.github.com/users/php/followers","following_url":"https://api.github.com/users/php/following{/other_user}","gists_url":"https://api.github.com/users/php/gists{/gist_id}","starred_url":"https://api.github.com/users/php/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php/subscriptions","organizations_url":"https://api.github.com/users/php/orgs","repos_url":"https://api.github.com/users/php/repos","events_url":"https://api.github.com/users/php/events{/privacy}","received_events_url":"https://api.github.com/users/php/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/php/php-src","description":"The PHP Interpreter","fork":false,"url":"https://api.github.com/repos/php/php-src","forks_url":"https://api.github.com/repos/php/php-src/forks","keys_url":"https://api.github.com/repos/php/php-src/keys{/key_id}","collaborators_url":"https://api.github.com/repos/php/php-src/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/php/php-src/teams","hooks_url":"https://api.github.com/repos/php/php-src/hooks","issue_events_url":"https://api.github.com/repos/php/php-src/issues/events{/number}","events_url":"https://api.github.com/repos/php/php-src/events","assignees_url":"https://api.github.com/repos/php/php-src/assignees{/user}","branches_url":"https://api.github.com/repos/php/php-src/branches{/branch}","tags_url":"https://api.github.com/repos/php/php-src/tags","blobs_url":"https://api.github.com/repos/php/php-src/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/php/php-src/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/php/php-src/git/refs{/sha}","trees_url":"https://api.github.com/repos/php/php-src/git/trees{/sha}","statuses_url":"https://api.github.com/repos/php/php-src/statuses/{sha}","languages_url":"https://api.github.com/repos/php/php-src/languages","stargazers_url":"https://api.github.com/repos/php/php-src/stargazers","contributors_url":"https://api.github.com/repos/php/php-src/contributors","subscribers_url":"https://api.github.com/repos/php/php-src/subscribers","subscription_url":"https://api.github.com/repos/php/php-src/subscription","commits_url":"https://api.github.com/repos/php/php-src/commits{/sha}","git_commits_url":"https://api.github.com/repos/php/php-src/git/commits{/sha}","comments_url":"https://api.github.com/repos/php/php-src/comments{/number}","issue_comment_url":"https://api.github.com/repos/php/php-src/issues/comments{/number}","contents_url":"https://api.github.com/repos/php/php-src/contents/{+path}","compare_url":"https://api.github.com/repos/php/php-src/compare/{base}...{head}","merges_url":"https://api.github.com/repos/php/php-src/merges","archive_url":"https://api.github.com/repos/php/php-src/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/php/php-src/downloads","issues_url":"https://api.github.com/repos/php/php-src/issues{/number}","pulls_url":"https://api.github.com/repos/php/php-src/pulls{/number}","milestones_url":"https://api.github.com/repos/php/php-src/milestones{/number}","notifications_url":"https://api.github.com/repos/php/php-src/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/php/php-src/labels{/name}","releases_url":"https://api.github.com/repos/php/php-src/releases{/id}","created_at":"2011-06-16T01:52:25Z","updated_at":"2015-08-06T17:58:11Z","pushed_at":"2015-08-06T17:05:56Z","git_url":"git://github.com/php/php-src.git","ssh_url":"git@github.com:php/php-src.git","clone_url":"https://github.com/php/php-src.git","svn_url":"https://github.com/php/php-src","homepage":"http://www.php.net","size":4136566,"stargazers_count":6504,"watchers_count":6504,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2347,"mirror_url":null,"open_issues_count":231,"forks":2347,"open_issues":231,"watchers":6504,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/php/php-src/pulls/1455"},"html":{"href":"https://github.com/php/php-src/pull/1455"},"issue":{"href":"https://api.github.com/repos/php/php-src/issues/1455"},"comments":{"href":"https://api.github.com/repos/php/php-src/issues/1455/comments"},"review_comments":{"href":"https://api.github.com/repos/php/php-src/pulls/1455/comments"},"review_comment":{"href":"https://api.github.com/repos/php/php-src/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/php/php-src/pulls/1455/commits"},"statuses":{"href":"https://api.github.com/repos/php/php-src/statuses/08ac858676daa0b2e4e6ec2b58d3d689403db41f"}}}}