Skip to content
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

[SR-7650] Incorrect result adding Decimals #3706

Closed
swift-ci opened this issue May 10, 2018 · 7 comments
Closed

[SR-7650] Incorrect result adding Decimals #3706

swift-ci opened this issue May 10, 2018 · 7 comments
Assignees

Comments

@swift-ci
Copy link
Contributor

swift-ci commented May 10, 2018

Previous ID SR-7650
Radar None
Original Reporter niftygrifty (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Linux / Swift 4.1

Additional Detail from JIRA
Votes 1
Component/s Foundation
Labels Bug
Assignee @spevans
Priority Medium

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.

@spevans
Copy link
Collaborator

spevans commented May 11, 2018

#1550

@swift-ci
Copy link
Contributor Author

swift-ci commented May 22, 2018

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.

@swift-ci
Copy link
Contributor Author

swift-ci commented May 25, 2018

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

@spevans
Copy link
Collaborator

spevans commented Jun 12, 2018

This was back ported to the 4.2 branch and has just been merged in #1588

@swift-ci
Copy link
Contributor Author

swift-ci commented Jun 12, 2018

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.

@swift-ci
Copy link
Contributor Author

swift-ci commented Jul 30, 2018

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.

@swift-ci
Copy link
Contributor Author

swift-ci commented Jul 31, 2018

Comment by David Monagle (JIRA)

Great result![]( Thanks najacque (JIRA User))

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants