mirror of
https://github.com/apple/swift-algorithms
synced 2026-11-26 04:27:48 +00:00
Add Xcode project for building framework (#246)
This commit is contained in:
1 parent
34eec0dd27
commit
acb4100b54
10 files changed
+874
-1
No files matched your search
@@ -10,7 +10,28 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// For log(_:) and root(_:_:)
|
||||
#if swift(>=5.11)
|
||||
#if ALGORITHMS_DARWIN_ONLY
|
||||
internal import Darwin
|
||||
|
||||
extension Double {
|
||||
@_transparent
|
||||
internal static func root(_ x: Double, _ n: Int) -> Double {
|
||||
guard x >= 0 || n % 2 != 0 else { return .nan }
|
||||
if n == 3 { return cbrt(x) }
|
||||
return Double(signOf: x, magnitudeOf: pow(x.magnitude, 1/Double(n)))
|
||||
}
|
||||
|
||||
@_transparent
|
||||
internal static func log(_ x: Double) -> Double {
|
||||
Darwin.log(x)
|
||||
}
|
||||
|
||||
@_transparent
|
||||
internal static func log(onePlus x: Double) -> Double {
|
||||
Darwin.log1p(x)
|
||||
}
|
||||
}
|
||||
#elseif swift(>=5.11)
|
||||
internal import RealModule
|
||||
#elseif swift(>=5.10)
|
||||
import RealModule
|
||||
|
||||
Reference in new issue
Block a user