{"action":"created","issue":{"url":"https://api.github.com/repos/fable-compiler/Fable/issues/1620","repository_url":"https://api.github.com/repos/fable-compiler/Fable","labels_url":"https://api.github.com/repos/fable-compiler/Fable/issues/1620/labels{/name}","comments_url":"https://api.github.com/repos/fable-compiler/Fable/issues/1620/comments","events_url":"https://api.github.com/repos/fable-compiler/Fable/issues/1620/events","html_url":"https://github.com/fable-compiler/Fable/issues/1620","id":375493916,"node_id":"MDU6SXNzdWUzNzU0OTM5MTY=","number":1620,"title":"Unsound decimal behavior","user":{"login":"toburger","id":728782,"node_id":"MDQ6VXNlcjcyODc4Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/728782?v=4","gravatar_id":"","url":"https://api.github.com/users/toburger","html_url":"https://github.com/toburger","followers_url":"https://api.github.com/users/toburger/followers","following_url":"https://api.github.com/users/toburger/following{/other_user}","gists_url":"https://api.github.com/users/toburger/gists{/gist_id}","starred_url":"https://api.github.com/users/toburger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toburger/subscriptions","organizations_url":"https://api.github.com/users/toburger/orgs","repos_url":"https://api.github.com/users/toburger/repos","events_url":"https://api.github.com/users/toburger/events{/privacy}","received_events_url":"https://api.github.com/users/toburger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-10-30T13:39:29Z","updated_at":"2018-10-31T11:25:01Z","closed_at":null,"author_association":"NONE","body":"### Description\r\n\r\nI know decimals in fable aren't really decimals, but this was quite a surprise for me:\r\n\r\n### Repro code\r\n\r\n```fsharp\r\n\r\nlet items = [\r\n    290.8M\r\n    290.8M\r\n    337.12M\r\n    6.08M\r\n   -924.8M\r\n]\r\n\r\nif List.sum items = 0M then\r\n\t// do something if sum is zero\r\nelse\r\n\t// do something else\r\n\r\n```\r\n\r\n[Link to Fable REPL](http://fable.io/repl2/#?code=LYewJgrgNgpgBAERgYwJbAIZQFDdgFzlXxmAGc4BeOAbWzgbgCYBOABgDoAOAWXsdade-BgGZRAdg4BGJn0ZwAbBzbCFAWhZMALNz4BdXAThkIwKnAAyqMvg6nzxUmVwAHAE6oAdvgBmXuAAiAFIAQUCTMzdPH38g4N8Ih1xUX0jzajYeOHwACxgvETgPbz8AwIciCgAvGHcQAEJA7BgoMhgiktjygHVQgBVm7CA&html=DwCwLgtgNgfAUHUBTAhgE3gAm54ElgqbhgAOAtEgI4CuAlgG4C8A5AMID2AdmEj+QBUAnqSQtMAY268erXgA8wAenDQA3JJAoATgGcCTGmABm5ABwssOYLona6pMJO0ddujvYDmdLpl3aJJgAiElJdAC4lJRouUgBrTwA6KQglbVQJMAABAEYANmiINDSMsETSFzQaTLpuRIgfRIArXSCYYCVbe0crbBs7Byc7V3cvHz8A4NCIqJj4pJSSlEzyNA4IXIKaIqWVtYhyyuqwWq56xpa2jq7B+A6QVAwEYAAjDjQhSSgUN2CUUgoUh4KB8SG0bTgOFwaEYmDoaGCSCgDV0IHI-1IQS+P10iORdFR6IBVyUMIYdyUbw+8EQKkgsDgQA&css=BYFwtgNgNAUARgewCYE8AEBvGadoGYIB2IAtAM4CWAXgKYBcaAjAGwAOAHgNwwC+MMAOjABDCoRIBjIiFGEaAJ0zZcSCmVYRhKBngg0uynAHcKSEMAaMADFYCk3XGmA0KAc1CWb9w2gBWAVzIQCjwUSWkaYgYJSJAFB1xhCDdxCjiwMmjY+J9dfRJVeRoJYKJohAh-MEJuPkExVn8QJUdWYSRVQlcGAQAmAFYisAScAmJyanomNgNHEzMLNAGrDhG0EXlXMRJEEBAEMEsh2pggA)\r\n\r\n### Expected and actual results\r\n\r\nI was expecting that the sum of the following values to be `0`.\r\nThe actual value is `1.1368683772161603e-13`.\r\n\r\nThis is quite unexpected for an F# developer where one of the language slogans is robustness.\r\nThe result is totally expected for floats, but it is a bug for decimals.\r\n\r\nThe following solutions would help avoid imprecise decimal values and gain trust in Fable:\r\n\r\n- Disallow decimals. This sounds very radical, but since there is no equivalent replacement for decimals it is the best to give a compiler error before such kind of bugs can happen.\r\n- Same as above, but give a warning.\r\n- Replace decimals with something provided by Fable."},"comment":{"url":"https://api.github.com/repos/fable-compiler/Fable/issues/comments/434651511","html_url":"https://github.com/fable-compiler/Fable/issues/1620#issuecomment-434651511","issue_url":"https://api.github.com/repos/fable-compiler/Fable/issues/1620","id":434651511,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDY1MTUxMQ==","user":{"login":"toburger","id":728782,"node_id":"MDQ6VXNlcjcyODc4Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/728782?v=4","gravatar_id":"","url":"https://api.github.com/users/toburger","html_url":"https://github.com/toburger","followers_url":"https://api.github.com/users/toburger/followers","following_url":"https://api.github.com/users/toburger/following{/other_user}","gists_url":"https://api.github.com/users/toburger/gists{/gist_id}","starred_url":"https://api.github.com/users/toburger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toburger/subscriptions","organizations_url":"https://api.github.com/users/toburger/orgs","repos_url":"https://api.github.com/users/toburger/repos","events_url":"https://api.github.com/users/toburger/events{/privacy}","received_events_url":"https://api.github.com/users/toburger/received_events","type":"User","site_admin":false},"created_at":"2018-10-31T11:25:01Z","updated_at":"2018-10-31T11:25:01Z","author_association":"NONE","body":"#### Correction:\r\n\r\nBigInt is implemented, but the literal doesn't seem to work:\r\n* `bigint.Parse \"12345678912345\"` works and gives 12345678912345\r\n* `12345678912345I` gives 1942903641"}}
{"actor":{"display_login":"toburger"}}