File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 22
22
import Glibc
23
23
#endif
24
24
25
+ #if (arch(i386) || arch(x86_64)) && !os(Windows)
26
+ typealias TestLiteralType = Float80
27
+ #else
28
+ typealias TestLiteralType = Double
29
+ #endif
30
+
25
31
import StdlibUnittest
26
32
27
33
let MathTests = TestSuite ( " TGMath " )
28
34
29
- func expectEqualWithTolerance< T> ( _ expected: _MaxBuiltinFloatType , _ actual: T ,
35
+ func expectEqualWithTolerance< T> ( _ expected: TestLiteralType , _ actual: T ,
30
36
ulps allowed: T = 3 ,
31
37
file: String = #file, line: UInt = #line)
32
38
where T: BinaryFloatingPoint {
33
39
if actual == T ( expected) || actual. isNaN && expected. isNaN {
34
40
return
35
41
}
36
42
// Compute error in ulp, compare to tolerance.
37
- let absoluteError = T ( abs ( _MaxBuiltinFloatType ( actual) - expected) )
43
+ let absoluteError = T ( abs ( TestLiteralType ( actual) - expected) )
38
44
let ulpError = absoluteError / T( expected) . ulp
39
45
expectTrue ( ulpError <= allowed,
40
46
" \( actual) != \( expected) as \( T . self) " +
You can’t perform that action at this time.
0 commit comments