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-8798] BinaryFloatingPoint.random(in:) crashes on some valid ranges #51306

Open
hartbit opened this issue Sep 19, 2018 · 2 comments
Open

[SR-8798] BinaryFloatingPoint.random(in:) crashes on some valid ranges #51306

hartbit opened this issue Sep 19, 2018 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@hartbit
Copy link
Collaborator

hartbit commented Sep 19, 2018

Previous ID SR-8798
Radar None
Original Reporter @hartbit
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee None
Priority Medium

md5: e4ed61953fff624b3e51c4a4dfb662dd

Issue Description:

The following piece of code crashes at runtime:

extension BinaryFloatingPoint where Self.RawSignificand: FixedWidthInteger {
    static func random() -> Self {
        return random(in: -greatestFiniteMagnitude..<greatestFiniteMagnitude)
    }
} 

Because of

This should be fixed.

@belkadan
Copy link
Contributor

cc @stephentyrone, @Azoy

@stephentyrone
Copy link
Member

Yes, this is a known limitation of the algorithm that is currently in use; we're planning to fix it in 5.0.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

3 participants