aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/math.zig
diff options
context:
space:
mode:
authorJohn Schmidt <john.schmidt.h@gmail.com>2022-02-04 20:21:15 +0100
committerAndrew Kelley <andrew@ziglang.org>2022-02-07 16:52:19 -0700
commit722d4a11bbba4052558f6f69b7e710d1206f3355 (patch)
tree5c98c05bb228555a7b7e9bf3c71d48538c3b84e4 /test/behavior/math.zig
parentdd49ed1c642d917af40bf4a0e03d013f40b3903b (diff)
downloadzig-722d4a11bbba4052558f6f69b7e710d1206f3355.tar.gz
zig-722d4a11bbba4052558f6f69b7e710d1206f3355.zip
stage2: implement @sqrt for f{16,32,64}
Support for f128, comptime_float, and c_longdouble require improvements to compiler_rt and will implemented in a later PR. Some of the code in this commit could be made more generic, for instance `llvm.airSqrt` could probably be `llvm.airUnaryMath`, but let's cross that bridge when we get to it.
Diffstat (limited to 'test/behavior/math.zig')
-rw-r--r--test/behavior/math.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/behavior/math.zig b/test/behavior/math.zig
index a1243eb7c1..c23e8ebe3e 100644
--- a/test/behavior/math.zig
+++ b/test/behavior/math.zig
@@ -792,8 +792,6 @@ fn remdiv(comptime T: type) !void {
}
test "@sqrt" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
-
try testSqrt(f64, 12.0);
comptime try testSqrt(f64, 12.0);
try testSqrt(f32, 13.0);
@@ -801,10 +799,12 @@ test "@sqrt" {
try testSqrt(f16, 13.0);
comptime try testSqrt(f16, 13.0);
- const x = 14.0;
- const y = x * x;
- const z = @sqrt(y);
- comptime try expect(z == x);
+ if (builtin.zig_backend == .stage1) {
+ const x = 14.0;
+ const y = x * x;
+ const z = @sqrt(y);
+ comptime try expect(z == x);
+ }
}
fn testSqrt(comptime T: type, x: T) !void {