[swift-evolution] TrigonometricFloatingPoint/MathFloatingPoint protocol?

Adrian Zubarev adrian.zubarev at devandartist.com
Mon Jul 31 12:23:37 CDT 2017

I’m not sure how I would feel about this. To be honest I’d avoid such additional changes from the stdlib, because they really don’t belong there. Instead some `Math` module/package would be a better fit than clustering everything into stdlib until we end up also adding UI stuff.

Furthermore, I don’t think a function would make any sense here. It really should be a computed property.

Am 31. Juli 2017 um 19:03:49, Taylor Swift via swift-evolution (swift-evolution at swift.org) schrieb:

How would people feel about adding a protocol

protocol MathFloatingPoint:FloatingPoint
    func sin() -> Self
    func cos() -> Self
    func tan() -> Self
    func asin() -> Self
    func acos() -> Self
    func atan() -> Self

    func ln() -> Self
    func log(base:Self) -> Self
    func pow(exponent:Self) -> Self
    func exp() -> Self

to the standard library? Float and Double would then be made to conform by default using Swift implementations instead of having to import Glibc / Darwin and writing the extensions, depending on platform.
swift-evolution mailing list
swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170731/cca642b1/attachment.html>

More information about the swift-evolution mailing list