| ... | @@ -155,15 +155,14 @@ test "@sin" { | ... | @@ -155,15 +155,14 @@ test "@sin" { |
| 155 | | 155 | |
| 156 | fn testSin() !void { | 156 | fn testSin() !void { |
| 157 | // stage1 emits an incorrect compile error for `@as(ty, std.math.pi / 2)` | 157 | // stage1 emits an incorrect compile error for `@as(ty, std.math.pi / 2)` |
| 158 | // so skip the rest of the tests. | 158 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 159 | if (builtin.zig_backend != .stage1) { | 159 | |
| 160 | inline for ([_]type{ f16, f32, f64 }) |ty| { | 160 | inline for ([_]type{ f16, f32, f64 }) |ty| { |
| 161 | const eps = epsForType(ty); | 161 | const eps = epsForType(ty); |
| 162 | try expect(@sin(@as(ty, 0)) == 0); | 162 | try expect(@sin(@as(ty, 0)) == 0); |
| 163 | try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi)), 0, eps)); | 163 | try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi)), 0, eps)); |
| 164 | try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi / 2)), 1, eps)); | 164 | try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi / 2)), 1, eps)); |
| 165 | try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi / 4)), 0.7071067811865475, eps)); | 165 | try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi / 4)), 0.7071067811865475, eps)); |
| 166 | } | | |
| 167 | } | 166 | } |
| 168 | | 167 | |
| 169 | { | 168 | { |
| ... | @@ -183,15 +182,14 @@ test "@cos" { | ... | @@ -183,15 +182,14 @@ test "@cos" { |
| 183 | | 182 | |
| 184 | fn testCos() !void { | 183 | fn testCos() !void { |
| 185 | // stage1 emits an incorrect compile error for `@as(ty, std.math.pi / 2)` | 184 | // stage1 emits an incorrect compile error for `@as(ty, std.math.pi / 2)` |
| 186 | // so skip the rest of the tests. | 185 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 187 | if (builtin.zig_backend != .stage1) { | 186 | |
| 188 | inline for ([_]type{ f16, f32, f64 }) |ty| { | 187 | inline for ([_]type{ f16, f32, f64 }) |ty| { |
| 189 | const eps = epsForType(ty); | 188 | const eps = epsForType(ty); |
| 190 | try expect(@cos(@as(ty, 0)) == 1); | 189 | try expect(@cos(@as(ty, 0)) == 1); |
| 191 | try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi)), -1, eps)); | 190 | try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi)), -1, eps)); |
| 192 | try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi / 2)), 0, eps)); | 191 | try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi / 2)), 0, eps)); |
| 193 | try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi / 4)), 0.7071067811865475, eps)); | 192 | try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi / 4)), 0.7071067811865475, eps)); |
| 194 | } | | |
| 195 | } | 193 | } |
| 196 | | 194 | |
| 197 | { | 195 | { |