{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/4221","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/4221/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/4221/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/4221/events","html_url":"https://github.com/dotnet/roslyn/issues/4221","id":98097587,"number":4221,"title":"Roslyn occasionally parses double values incorrectly","user":{"login":"gafter","id":3804346,"avatar_url":"https://avatars.githubusercontent.com/u/3804346?v=3","gravatar_id":"","url":"https://api.github.com/users/gafter","html_url":"https://github.com/gafter","followers_url":"https://api.github.com/users/gafter/followers","following_url":"https://api.github.com/users/gafter/following{/other_user}","gists_url":"https://api.github.com/users/gafter/gists{/gist_id}","starred_url":"https://api.github.com/users/gafter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gafter/subscriptions","organizations_url":"https://api.github.com/users/gafter/orgs","repos_url":"https://api.github.com/users/gafter/repos","events_url":"https://api.github.com/users/gafter/events{/privacy}","received_events_url":"https://api.github.com/users/gafter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Compilers","name":"Area-Compilers","color":"5319e7"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Bug","name":"Bug","color":"fc2929"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Determinism","name":"Determinism","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"AlekseyTs","id":10522107,"avatar_url":"https://avatars.githubusercontent.com/u/10522107?v=3","gravatar_id":"","url":"https://api.github.com/users/AlekseyTs","html_url":"https://github.com/AlekseyTs","followers_url":"https://api.github.com/users/AlekseyTs/followers","following_url":"https://api.github.com/users/AlekseyTs/following{/other_user}","gists_url":"https://api.github.com/users/AlekseyTs/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekseyTs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekseyTs/subscriptions","organizations_url":"https://api.github.com/users/AlekseyTs/orgs","repos_url":"https://api.github.com/users/AlekseyTs/repos","events_url":"https://api.github.com/users/AlekseyTs/events{/privacy}","received_events_url":"https://api.github.com/users/AlekseyTs/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/3","html_url":"https://github.com/dotnet/roslyn/milestones/1.1","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/3/labels","id":937401,"number":3,"title":"1.1","description":"This is our 1.1 Milestone.\r\n\r\n<!---\r\n@huboard:{\"order\":1.5}\r\n-->\r\n","creator":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"open_issues":461,"closed_issues":137,"state":"open","created_at":"2015-01-15T20:48:41Z","updated_at":"2015-07-31T18:29:19Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-07-30T06:43:19Z","updated_at":"2015-07-31T18:30:19Z","closed_at":null,"body":"The following one-line program fails when compiled with the Roslyn command-line compiler (on x64) and run on x86 due to an underlying bug in double.Parse.\r\n\r\n```cs\r\n        System.Diagnostics.Debug.Assert(0.6822871999174 == double.Parse(\"0.6822871999174\"));\r\n```\r\n\r\nAn incorrect double value is baked into the generated assembly for the left-hand argument of ==.\r\n\r\nBecause of this issue the output of the compiler depends on whether the compiler is run on x86 or x64, so this is also a determinism issue.\r\n\r\nThe [IEEE spec](http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=4610935&tag=1) section 5.12.2 requires that we convert to the nearest representable double, with round-to-even as a tiebreaker for precise ties, when the input is 20 digits or fewer (and recommends doing so for longer inputs as well). Since this input has fewer than 20 digits, we have no excuse for different results.\r\n\r\n@jaredpar @DustinCampbell\r\n\r\nSee also #4149 "},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/126777564","html_url":"https://github.com/dotnet/roslyn/issues/4221#issuecomment-126777564","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/4221","id":126777564,"user":{"login":"gafter","id":3804346,"avatar_url":"https://avatars.githubusercontent.com/u/3804346?v=3","gravatar_id":"","url":"https://api.github.com/users/gafter","html_url":"https://github.com/gafter","followers_url":"https://api.github.com/users/gafter/followers","following_url":"https://api.github.com/users/gafter/following{/other_user}","gists_url":"https://api.github.com/users/gafter/gists{/gist_id}","starred_url":"https://api.github.com/users/gafter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gafter/subscriptions","organizations_url":"https://api.github.com/users/gafter/orgs","repos_url":"https://api.github.com/users/gafter/repos","events_url":"https://api.github.com/users/gafter/events{/privacy}","received_events_url":"https://api.github.com/users/gafter/received_events","type":"User","site_admin":false},"created_at":"2015-07-31T18:30:19Z","updated_at":"2015-07-31T18:30:19Z","body":"Indeed. Since `0.6822871999174` is closer to the precise value represented by the native compiler's output, the native compiler is correct and Roslyn is incorrect here."}}