|
17 | 17 | // RUN: %line-directive %t/tgmath.swift -- %target-run %t/a.out
|
18 | 18 | // REQUIRES: executable_test
|
19 | 19 |
|
20 |
| -#if canImport(Darwin) |
| 20 | +#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) |
21 | 21 | import Darwin.C.tgmath
|
22 |
| -#else |
| 22 | +#elseif os(Linux) || os(android) || os(FreeBSD) || os(Haiku) || os(PS4) |
23 | 23 | import Glibc
|
| 24 | +#elseif os(Windows) |
| 25 | + import MSVCRT |
24 | 26 | #endif
|
25 | 27 |
|
26 | 28 | #if (arch(i386) || arch(x86_64)) && !os(Windows)
|
@@ -77,7 +79,9 @@ internal protocol TGMath: BinaryFloatingPoint {
|
77 | 79 | %end
|
78 | 80 | static func _remquo(_ x: Self, _ y: Self) -> (Self, Int)
|
79 | 81 | static func _fma(_ x: Self, _ y: Self, _ z: Self) -> Self
|
| 82 | +#if !os(Windows) |
80 | 83 | static func _lgamma(_ x: Self) -> (Self, Int)
|
| 84 | +#endif |
81 | 85 | static func _modf(_ x: Self) -> (Self, Self)
|
82 | 86 | static func _scalbn(_ x: Self, _ n: Int) -> Self
|
83 | 87 | static func _frexp(_ x: Self) -> (Self, Int)
|
@@ -116,8 +120,10 @@ internal extension TGMath {
|
116 | 120 | expectEqualWithTolerance(0.4041169094348222983238250859191217675, Self._erf(0.375))
|
117 | 121 | expectEqualWithTolerance(0.5958830905651777016761749140808782324, Self._erfc(0.375))
|
118 | 122 | expectEqualWithTolerance(2.3704361844166009086464735041766525098, Self._tgamma(0.375))
|
| 123 | +#if !os(Windows) |
119 | 124 | expectEqualWithTolerance( -0.11775527074107877445136203331798850, Self._lgamma(1.375).0, ulps: 16)
|
120 | 125 | expectEqual(1, Self._lgamma(1.375).1)
|
| 126 | +#endif |
121 | 127 | expectEqual(1, Self._ceil(0.375))
|
122 | 128 | expectEqual(0, Self._floor(0.375))
|
123 | 129 | expectEqual(0, Self._nearbyint(0.375))
|
@@ -181,7 +187,9 @@ extension ${T}: TGMath {
|
181 | 187 | %end
|
182 | 188 | static func _remquo(_ x: ${T}, _ y: ${T}) -> (${T}, Int) { return remquo(x, y) }
|
183 | 189 | static func _fma(_ x: ${T}, _ y: ${T}, _ z: ${T}) -> ${T} { return fma(x, y, z) }
|
| 190 | +#if !os(Windows) |
184 | 191 | static func _lgamma(_ x: ${T}) -> (${T}, Int) { return lgamma(x) }
|
| 192 | +#endif |
185 | 193 | static func _modf(_ x: ${T}) -> (${T}, ${T}) { return modf(x) }
|
186 | 194 | static func _scalbn(_ x: ${T}, _ n: Int) -> ${T} { return scalbn(x, n) }
|
187 | 195 | static func _frexp(_ x: ${T}) -> (${T}, Int) { return frexp(x) }
|
|
0 commit comments