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/abs.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/abs.zig')
| -rw-r--r-- | lib/std/math/complex/abs.zig | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/std/math/complex/abs.zig b/lib/std/math/complex/abs.zig index ab85f2c36c..8b75db4a61 100644 --- a/lib/std/math/complex/abs.zig +++ b/lib/std/math/complex/abs.zig @@ -9,10 +9,9 @@ pub fn abs(z: anytype) @TypeOf(z.re, z.im) { return math.hypot(z.re, z.im); } -const epsilon = 0.0001; - test abs { + const epsilon = math.floatEps(f32); const a = Complex(f32).init(5, 3); const c = abs(a); - try testing.expect(math.approxEqAbs(f32, c, 5.83095, epsilon)); + try testing.expectApproxEqAbs(5.8309517, c, epsilon); } |
