aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math/complex/sin.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-07-31 19:19:27 -0700
committerGitHub <noreply@github.com>2024-07-31 19:19:27 -0700
commit059856acfc9f87d723a90af6a4214e128b8cae2e (patch)
tree851538dd757a467513f7061db4d2ec9b94a2c628 /lib/std/math/complex/sin.zig
parent7c5ee3efde6d948205c6f6eaa7ab52bda3715fea (diff)
parent843885512dd69e083ec9163e6f57822487b46639 (diff)
downloadzig-059856acfc9f87d723a90af6a4214e128b8cae2e.tar.gz
zig-059856acfc9f87d723a90af6a4214e128b8cae2e.zip
Merge pull request #20878 from tiehuis/std-math-complex-fixes
std.math.complex fixes
Diffstat (limited to 'lib/std/math/complex/sin.zig')
-rw-r--r--lib/std/math/complex/sin.zig7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/std/math/complex/sin.zig b/lib/std/math/complex/sin.zig
index 3ca2419e43..5ce5b335f8 100644
--- a/lib/std/math/complex/sin.zig
+++ b/lib/std/math/complex/sin.zig
@@ -12,12 +12,11 @@ pub fn sin(z: anytype) Complex(@TypeOf(z.re, z.im)) {
return Complex(T).init(q.im, -q.re);
}
-const epsilon = 0.0001;
-
test sin {
+ const epsilon = math.floatEps(f32);
const a = Complex(f32).init(5, 3);
const c = sin(a);
- try testing.expect(math.approxEqAbs(f32, c.re, -9.654126, epsilon));
- try testing.expect(math.approxEqAbs(f32, c.im, 2.841692, epsilon));
+ try testing.expectApproxEqAbs(-9.654126, c.re, epsilon);
+ try testing.expectApproxEqAbs(2.8416924, c.im, epsilon);
}