{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/217133731","pull_request_review_id":154775450,"id":217133731,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNzEzMzczMQ==","diff_hunk":"@@ -387,61 +398,34 @@ public static bool TryFormatDouble(double value, ReadOnlySpan<char> format, Numb\n         private static string FormatDouble(ref ValueStringBuilder sb, double value, ReadOnlySpan<char> format, NumberFormatInfo info)\n         {\n             char fmt = ParseFormatSpecifier(format, out int digits);\n-            int precision = DoublePrecision;\n+\n             NumberBuffer number = default;\n             number.kind = NumberBufferKind.Double;\n \n-            switch (fmt)\n-            {\n-                case 'R':\n-                case 'r':\n-                    {\n-                        // In order to give numbers that are both friendly to display and round-trippable, we parse the\n-                        // number using 15 digits and then determine if it round trips to the same value. If it does, we\n-                        // convert that NUMBER to a string, otherwise we reparse using 17 digits and display that.\n-                        DoubleToNumber(value, DoublePrecision, ref number);\n-                        if (number.scale == ScaleNAN)\n-                        {\n-                            return info.NaNSymbol;\n-                        }\n-                        else if (number.scale == ScaleINF)\n-                        {\n-                            return number.sign ? info.NegativeInfinitySymbol : info.PositiveInfinitySymbol;\n-                        }\n-\n-                        if (NumberToDouble(ref number) == value)\n-                        {\n-                            NumberToString(ref sb, ref number, 'G', DoublePrecision, info);\n-                        }\n-                        else\n-                        {\n-                            DoubleToNumber(value, 17, ref number);\n-                            NumberToString(ref sb, ref number, 'G', 17, info);\n-                        }\n+            int precision;\n \n-                        return null;\n-                    }\n-\n-                case 'E':\n-                case 'e':\n-                    // Round values less than E14 to 15 digits\n-                    if (digits > 14)\n-                    {\n-                        precision = 17;\n-                    }\n-                    break;\n+            if ((fmt == 'R') || (fmt == 'r'))\n+            {\n+                fmt = 'G';\n+                precision = DefaultDoublePrecision;\n \n-                case 'G':\n-                case 'g':\n-                    // Round values less than G15 to 15 digits. G16 and G17 will not be touched.\n-                    if (digits > 15)\n-                    {\n-                        precision = 17;\n-                    }\n-                    break;\n+                // IEEE Roundtripping requires us to include at least `17` digits\n+                digits = precision;\n+            }\n+            else if (digits <= 0)\n+            {\n+                // This ensures that, for the default case, we return a string containing the old\n+                // number of digits (15), which results in \"prettier\" numbers for most cases.\n+                precision = DefaultDoubleDigits;\n+            }\n+            else\n+            {\n+                // IEEE requires we correctly round to the requested number of digits\n+                precision = digits;","path":"src/System.Private.CoreLib/shared/System/Number.Formatting.cs","position":96,"original_position":96,"commit_id":"e16dfd155b131ebe52d2be0b47d4f648897b25e7","original_commit_id":"e16dfd155b131ebe52d2be0b47d4f648897b25e7","user":{"login":"tannergooding","id":10487869,"node_id":"MDQ6VXNlcjEwNDg3ODY5","avatar_url":"https://avatars3.githubusercontent.com/u/10487869?v=4","gravatar_id":"","url":"https://api.github.com/users/tannergooding","html_url":"https://github.com/tannergooding","followers_url":"https://api.github.com/users/tannergooding/followers","following_url":"https://api.github.com/users/tannergooding/following{/other_user}","gists_url":"https://api.github.com/users/tannergooding/gists{/gist_id}","starred_url":"https://api.github.com/users/tannergooding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tannergooding/subscriptions","organizations_url":"https://api.github.com/users/tannergooding/orgs","repos_url":"https://api.github.com/users/tannergooding/repos","events_url":"https://api.github.com/users/tannergooding/events{/privacy}","received_events_url":"https://api.github.com/users/tannergooding/received_events","type":"User","site_admin":false},"body":"Had to update this logic so that we preserve the fact that the user didn't explicitly specify a digit count, or that the user specified `0` for the digit count.\r\n\r\nThis makes a difference for things like `double.ToString(\"N\")` which i had accidentally made to be treated like `double.ToString(\"N15\")`.","created_at":"2018-09-12T18:05:19Z","updated_at":"2018-09-12T18:05:19Z","html_url":"https://github.com/dotnet/coreclr/pull/19905#discussion_r217133731","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/19905","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/217133731"},"html":{"href":"https://github.com/dotnet/coreclr/pull/19905#discussion_r217133731"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/19905"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/19905","id":214830153,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0ODMwMTUz","html_url":"https://github.com/dotnet/coreclr/pull/19905","diff_url":"https://github.com/dotnet/coreclr/pull/19905.diff","patch_url":"https://github.com/dotnet/coreclr/pull/19905.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/19905","number":19905,"state":"open","locked":false,"title":"Fix up the majority of IEEE compliance bugs for Double/Single ToString and Parse","user":{"login":"tannergooding","id":10487869,"node_id":"MDQ6VXNlcjEwNDg3ODY5","avatar_url":"https://avatars3.githubusercontent.com/u/10487869?v=4","gravatar_id":"","url":"https://api.github.com/users/tannergooding","html_url":"https://github.com/tannergooding","followers_url":"https://api.github.com/users/tannergooding/followers","following_url":"https://api.github.com/users/tannergooding/following{/other_user}","gists_url":"https://api.github.com/users/tannergooding/gists{/gist_id}","starred_url":"https://api.github.com/users/tannergooding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tannergooding/subscriptions","organizations_url":"https://api.github.com/users/tannergooding/orgs","repos_url":"https://api.github.com/users/tannergooding/repos","events_url":"https://api.github.com/users/tannergooding/events{/privacy}","received_events_url":"https://api.github.com/users/tannergooding/received_events","type":"User","site_admin":false},"body":"This resolves the majority of the issues covered by https://github.com/dotnet/coreclr/issues/19802:\r\n* Re-enables some tests temporarily disabled by https://github.com/dotnet/coreclr/pull/19775\r\n* Ensures that double.Parse for `-0` works correctly\r\n* Ensures that recovering `NaN`, `PositiveInfinity`, and `NegativeInfinity` is done case insensitively\r\n* Ensures that \"R\" always roundtrips to the required number of digits\r\n* Ensures that the \"precision\" specifier works up to `50` digits\r\n  * `50` is the current internal limit for `DoubleToNumber`\r\n  * IEEE requires at least `20` for Double and `12` for Single\r\n\r\nThis should resolve (validated locally, can close after CoreFX tests are added):\r\n* https://github.com/dotnet/coreclr/issues/1316\r\n* https://github.com/dotnet/coreclr/issues/3313\r\n* https://github.com/dotnet/coreclr/issues/13106\r\n* https://github.com/dotnet/coreclr/issues/13615\r\n* https://github.com/dotnet/coreclr/issues/16783\r\n* https://github.com/dotnet/coreclr/issues/17467\r\n\r\nThis does not handle:\r\n* `-nan` and `+nan`, which IEEE requires we support parsing, but which we can parse to \"Regular\" `NaN`\r\n* `snan`, which IEEE requires we support parsing; but which we can parse to \"regular\" `NaN`\r\n  * support for preceding `-` and `+` is also required for `snan`\r\n  * IEEE does not require us to support formatting `snan`, we are free to format to \"regular\" `NaN`.\r\n* `NaN` and `SNaN` payloads, which are optional\r\n* `+Infinity` (case insensitive), which IEEE requires we support parsing","created_at":"2018-09-12T04:07:57Z","updated_at":"2018-09-12T18:05:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2e1bc8b5d375892f1819640cecc7053655cd03e6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/19905/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/19905/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/19905/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/e16dfd155b131ebe52d2be0b47d4f648897b25e7","head":{"label":"tannergooding:ieee-tostring","ref":"ieee-tostring","sha":"e16dfd155b131ebe52d2be0b47d4f648897b25e7","user":{"login":"tannergooding","id":10487869,"node_id":"MDQ6VXNlcjEwNDg3ODY5","avatar_url":"https://avatars3.githubusercontent.com/u/10487869?v=4","gravatar_id":"","url":"https://api.github.com/users/tannergooding","html_url":"https://github.com/tannergooding","followers_url":"https://api.github.com/users/tannergooding/followers","following_url":"https://api.github.com/users/tannergooding/following{/other_user}","gists_url":"https://api.github.com/users/tannergooding/gists{/gist_id}","starred_url":"https://api.github.com/users/tannergooding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tannergooding/subscriptions","organizations_url":"https://api.github.com/users/tannergooding/orgs","repos_url":"https://api.github.com/users/tannergooding/repos","events_url":"https://api.github.com/users/tannergooding/events{/privacy}","received_events_url":"https://api.github.com/users/tannergooding/received_events","type":"User","site_admin":false},"repo":{"id":32194373,"node_id":"MDEwOlJlcG9zaXRvcnkzMjE5NDM3Mw==","name":"coreclr","full_name":"tannergooding/coreclr","owner":{"login":"tannergooding","id":10487869,"node_id":"MDQ6VXNlcjEwNDg3ODY5","avatar_url":"https://avatars3.githubusercontent.com/u/10487869?v=4","gravatar_id":"","url":"https://api.github.com/users/tannergooding","html_url":"https://github.com/tannergooding","followers_url":"https://api.github.com/users/tannergooding/followers","following_url":"https://api.github.com/users/tannergooding/following{/other_user}","gists_url":"https://api.github.com/users/tannergooding/gists{/gist_id}","starred_url":"https://api.github.com/users/tannergooding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tannergooding/subscriptions","organizations_url":"https://api.github.com/users/tannergooding/orgs","repos_url":"https://api.github.com/users/tannergooding/repos","events_url":"https://api.github.com/users/tannergooding/events{/privacy}","received_events_url":"https://api.github.com/users/tannergooding/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tannergooding/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":true,"url":"https://api.github.com/repos/tannergooding/coreclr","forks_url":"https://api.github.com/repos/tannergooding/coreclr/forks","keys_url":"https://api.github.com/repos/tannergooding/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tannergooding/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tannergooding/coreclr/teams","hooks_url":"https://api.github.com/repos/tannergooding/coreclr/hooks","issue_events_url":"https://api.github.com/repos/tannergooding/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/tannergooding/coreclr/events","assignees_url":"https://api.github.com/repos/tannergooding/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/tannergooding/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/tannergooding/coreclr/tags","blobs_url":"https://api.github.com/repos/tannergooding/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tannergooding/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tannergooding/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/tannergooding/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tannergooding/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/tannergooding/coreclr/languages","stargazers_url":"https://api.github.com/repos/tannergooding/coreclr/stargazers","contributors_url":"https://api.github.com/repos/tannergooding/coreclr/contributors","subscribers_url":"https://api.github.com/repos/tannergooding/coreclr/subscribers","subscription_url":"https://api.github.com/repos/tannergooding/coreclr/subscription","commits_url":"https://api.github.com/repos/tannergooding/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/tannergooding/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/tannergooding/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/tannergooding/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/tannergooding/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/tannergooding/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tannergooding/coreclr/merges","archive_url":"https://api.github.com/repos/tannergooding/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tannergooding/coreclr/downloads","issues_url":"https://api.github.com/repos/tannergooding/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/tannergooding/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/tannergooding/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/tannergooding/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tannergooding/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/tannergooding/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/tannergooding/coreclr/deployments","created_at":"2015-03-14T03:37:19Z","updated_at":"2018-08-25T15:15:11Z","pushed_at":"2018-09-12T18:03:25Z","git_url":"git://github.com/tannergooding/coreclr.git","ssh_url":"git@github.com:tannergooding/coreclr.git","clone_url":"https://github.com/tannergooding/coreclr.git","svn_url":"https://github.com/tannergooding/coreclr","homepage":"","size":237650,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"598fca6348cbedc9cadb92aabf00b0f6f181bf83","user":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":30092893,"node_id":"MDEwOlJlcG9zaXRvcnkzMDA5Mjg5Mw==","name":"coreclr","full_name":"dotnet/coreclr","owner":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called System.Private.Corelib (or mscorlib). It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes. We welcome contributions.","fork":false,"url":"https://api.github.com/repos/dotnet/coreclr","forks_url":"https://api.github.com/repos/dotnet/coreclr/forks","keys_url":"https://api.github.com/repos/dotnet/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/coreclr/teams","hooks_url":"https://api.github.com/repos/dotnet/coreclr/hooks","issue_events_url":"https://api.github.com/repos/dotnet/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/coreclr/events","assignees_url":"https://api.github.com/repos/dotnet/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/coreclr/tags","blobs_url":"https://api.github.com/repos/dotnet/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/coreclr/languages","stargazers_url":"https://api.github.com/repos/dotnet/coreclr/stargazers","contributors_url":"https://api.github.com/repos/dotnet/coreclr/contributors","subscribers_url":"https://api.github.com/repos/dotnet/coreclr/subscribers","subscription_url":"https://api.github.com/repos/dotnet/coreclr/subscription","commits_url":"https://api.github.com/repos/dotnet/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/coreclr/merges","archive_url":"https://api.github.com/repos/dotnet/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/coreclr/downloads","issues_url":"https://api.github.com/repos/dotnet/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/coreclr/deployments","created_at":"2015-01-30T22:10:02Z","updated_at":"2018-09-12T16:35:06Z","pushed_at":"2018-09-12T18:03:27Z","git_url":"git://github.com/dotnet/coreclr.git","ssh_url":"git@github.com:dotnet/coreclr.git","clone_url":"https://github.com/dotnet/coreclr.git","svn_url":"https://github.com/dotnet/coreclr","homepage":"https://github.com/dotnet/core","size":241157,"stargazers_count":9898,"watchers_count":9898,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2430,"mirror_url":null,"archived":false,"open_issues_count":1849,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2430,"open_issues":1849,"watchers":9898,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/19905"},"html":{"href":"https://github.com/dotnet/coreclr/pull/19905"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/19905"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/19905/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/19905/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/19905/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/e16dfd155b131ebe52d2be0b47d4f648897b25e7"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"tannergooding"}}