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-11514] Decimal.init(_ value: Double) sometimes yields incorrect value #3389

Closed
swift-ci opened this issue Sep 24, 2019 · 0 comments
Closed

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-11514
Radar None
Original Reporter pierremb (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
Target: x86_64-apple-darwin18.7.0

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 3222b51ace774646727b041f89ba887e

duplicates:

  • SR-8409 Decimal initialized with Double loses precision

Issue Description:

`Decimal(76.84)` returns 76.84000000000002048 instead.
However `Decimal("76.84")` returns the correct value.

run `swift Decimal.swift` (attached) to check

PS: I think at some point `NSDecimalNumber(value: 76.84) as Decimal` would return the correct value also

@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

1 participant