| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | const builtin = @import("builtin"); |
| 1 | 2 | const std = @import("../std.zig"); |
| 2 | 3 | const math = std.math; |
| 3 | 4 | const expect = std.testing.expect; |
| ... | ... | @@ -92,10 +93,12 @@ const hypot_test_cases = .{ |
| 92 | 93 | }; |
| 93 | 94 | |
| 94 | 95 | test hypot { |
| 96 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 |
| 95 | 97 | try expect(hypot(0.3, 0.4) == 0.5); |
| 96 | 98 | } |
| 97 | 99 | |
| 98 | 100 | test "hypot.correct" { |
| 101 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 |
| 99 | 102 | inline for (.{ f16, f32, f64, f128 }) |T| { |
| 100 | 103 | inline for (hypot_test_cases) |v| { |
| 101 | 104 | const a: T, const b: T, const c: T = v; |
| ... | ... | @@ -105,6 +108,7 @@ test "hypot.correct" { |
| 105 | 108 | } |
| 106 | 109 | |
| 107 | 110 | test "hypot.precise" { |
| 111 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 |
| 108 | 112 | inline for (.{ f16, f32, f64 }) |T| { // f128 seems to be 5 ulp |
| 109 | 113 | inline for (hypot_test_cases) |v| { |
| 110 | 114 | const a: T, const b: T, const c: T = v; |
| ... | ... | @@ -114,6 +118,7 @@ test "hypot.precise" { |
| 114 | 118 | } |
| 115 | 119 | |
| 116 | 120 | test "hypot.special" { |
| 121 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 |
| 117 | 122 | @setEvalBranchQuota(2000); |
| 118 | 123 | inline for (.{ f16, f32, f64, f128 }) |T| { |
| 119 | 124 | try expect(math.isNan(hypot(nan(T), 0.0))); |