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-8484] Using generic math functions fails in Swift 4.2 #51005

Open
swift-ci opened this issue Aug 7, 2018 · 1 comment
Open

[SR-8484] Using generic math functions fails in Swift 4.2 #51005

swift-ci opened this issue Aug 7, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself standard library Area: Standard library umbrella

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Aug 7, 2018

Previous ID SR-8484
Radar None
Original Reporter strike (JIRA User)
Type Bug
Environment

Xcode 10 beta, Swift 4.2

Additional Detail from JIRA
Votes 0
Component/s Compiler, Standard Library
Labels Bug
Assignee None
Priority Medium

md5: adc7cdc3c52b5393377de6fa09b0bc78

Issue Description:

Hi!

When using function like lgamma() or tgamma() the compiler complains about

"ambiguous use of tgamma()/lgamma()"

Details can be found here:

https://forums.swift.org/t/float80-math-function/14968/4?u=strike

Regards!

@stephentyrone
Copy link
Member

It looks like the c stdlib interfaces for all of the math functions are now being exported as well as the Swift overlay names, e.g. for sin( ) we have all of the following:

sin(Double) -> Double
sin(x: Double) -> Double
sin(x: Float) -> Float
sin(x: Float80) -> Float80
sinf(Float) -> Float
sinl(Float80) -> Float80

In the case of lgamma, the return type of the C libm functions is actually different:

lgamma(Double) -> Double
lgamma(x: Double) -> (Double, Int)
lgamma(x: Float) -> (Float, Int)
lgamma(x: Float80) -> (Float80, Int)
lgammaf(Float) -> Float
lgammal(Float80) -> Float80

which I think causes the bug we're seeing here.

@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. compiler The Swift compiler in itself standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants