diff options
| author | Marc Tiehuis <marc@tiehu.is> | 2024-07-30 16:29:51 +1200 |
|---|---|---|
| committer | Marc Tiehuis <marc@tiehu.is> | 2024-07-30 16:30:20 +1200 |
| commit | 0fda2f31aae2109886c74b352ea4dee23ce6eb74 (patch) | |
| tree | c9c5e20831f68b0d38dd95a9a73bd92b10688939 /lib/std/math/complex/sin.zig | |
| parent | 2bd7af63d76d1c61bfd77a5402f94d105c375a1d (diff) | |
| download | zig-0fda2f31aae2109886c74b352ea4dee23ce6eb74.tar.gz zig-0fda2f31aae2109886c74b352ea4dee23ce6eb74.zip | |
std.math.complex: tighten existing test bounds
Diffstat (limited to 'lib/std/math/complex/sin.zig')
| -rw-r--r-- | lib/std/math/complex/sin.zig | 7 |
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); } |
