| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| | 1 | const builtin = @import("builtin"); |
| 1 | const std = @import("../std.zig"); | 2 | const std = @import("../std.zig"); |
| 2 | const math = std.math; | 3 | const math = std.math; |
| 3 | const expect = std.testing.expect; | 4 | const expect = std.testing.expect; |
| ... | @@ -92,10 +93,12 @@ const hypot_test_cases = .{ | ... | @@ -92,10 +93,12 @@ const hypot_test_cases = .{ |
| 92 | }; | 93 | }; |
| 93 | | 94 | |
| 94 | test hypot { | 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 | try expect(hypot(0.3, 0.4) == 0.5); | 97 | try expect(hypot(0.3, 0.4) == 0.5); |
| 96 | } | 98 | } |
| 97 | | 99 | |
| 98 | test "hypot.correct" { | 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 | inline for (.{ f16, f32, f64, f128 }) |T| { | 102 | inline for (.{ f16, f32, f64, f128 }) |T| { |
| 100 | inline for (hypot_test_cases) |v| { | 103 | inline for (hypot_test_cases) |v| { |
| 101 | const a: T, const b: T, const c: T = v; | 104 | const a: T, const b: T, const c: T = v; |
| ... | @@ -105,6 +108,7 @@ test "hypot.correct" { | ... | @@ -105,6 +108,7 @@ test "hypot.correct" { |
| 105 | } | 108 | } |
| 106 | | 109 | |
| 107 | test "hypot.precise" { | 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 | inline for (.{ f16, f32, f64 }) |T| { // f128 seems to be 5 ulp | 112 | inline for (.{ f16, f32, f64 }) |T| { // f128 seems to be 5 ulp |
| 109 | inline for (hypot_test_cases) |v| { | 113 | inline for (hypot_test_cases) |v| { |
| 110 | const a: T, const b: T, const c: T = v; | 114 | const a: T, const b: T, const c: T = v; |
| ... | @@ -114,6 +118,7 @@ test "hypot.precise" { | ... | @@ -114,6 +118,7 @@ test "hypot.precise" { |
| 114 | } | 118 | } |
| 115 | | 119 | |
| 116 | test "hypot.special" { | 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 | @setEvalBranchQuota(2000); | 122 | @setEvalBranchQuota(2000); |
| 118 | inline for (.{ f16, f32, f64, f128 }) |T| { | 123 | inline for (.{ f16, f32, f64, f128 }) |T| { |
| 119 | try expect(math.isNan(hypot(nan(T), 0.0))); | 124 | try expect(math.isNan(hypot(nan(T), 0.0))); |