-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[SR-7650] Incorrect result adding Decimals #3706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Comment by David Monagle (JIRA) Given the fact that this bug induces wildly incorrect results for a type that is the preferred option for currency calculations, shouldn't this be at least a high priority? This bug is in the current production release of Swift and will be affecting anybody running a production system. |
Comment by Taylor Griffin (JIRA) @spevans: Thank you for making a PR for this issue right away. I noticed it was just merged. Any idea about a timeline for a patch release? Attn: @admin |
This was back ported to the 4.2 branch and has just been merged in #1588 |
Comment by David Monagle (JIRA) So master (JIRA User) my understanding is that anybody using Decimal in production in 4.1.2 should rewrite their code to avoid the Decimal type or otherwise remove it from a production environment? 4.2 won’t be released until September. |
Comment by Nicole Jacque (JIRA) We've released Swift 4.1.3 which picks up the fix for this, and the snapshot is available on the swift.org downloads page. |
Comment by David Monagle (JIRA) Great result) |
Environment
Linux / Swift 4.1
Additional Detail from JIRA
md5: 7c55bfb750d20ffab1a5ff97a6c5ad3a
Issue Description:
`Decimal(5538) + Decimal(2880.4)` results incorrectly in 1864.8.
`NSDecimalNumber(floatLiteral: 5538).adding(NSDecimalNumber(floatLiteral: 2880.4))` produces the same incorrect result.
The text was updated successfully, but these errors were encountered: