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-15156] Decimal(sign:exponent:significand:) traps for overly large exponents #3359

Closed
xwu opened this issue Sep 4, 2021 · 1 comment
Closed
Assignees

Comments

@xwu
Copy link
Collaborator

xwu commented Sep 4, 2021

Previous ID SR-15156
Radar None
Original Reporter @xwu
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee @xwu
Priority Medium

md5: 04f0e1ecffd41bad94ee12a23f35d9d1

Issue Description:

Consider the following:

import Foundation
let x = Double.greatestFiniteMagnitude
Double(sign: .plus, exponent: 10, significand: x) // +inf
Double(sign: .plus, exponent: .max, significand: x) // +inf
let y = Decimal.greatestFiniteMagnitude
Decimal(sign: .plus, exponent: 10, significand: y) // nan
Decimal(sign: .plus, exponent: .max, significand: y) // runtime error (!)

The expected result is that Decimal should overflow to NaN (since it has no representation of infinity).

@xwu
Copy link
Collaborator Author

xwu commented Sep 4, 2021

#3074

@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