diff options
| author | Lewis Gaul <lewis.gaul@gmail.com> | 2024-05-25 23:05:20 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-07-17 05:04:59 +0200 |
| commit | 03dfd2ecc37cc99b15d4ce3ff19147230ddc8fd4 (patch) | |
| tree | 884eb9f9b59110715ca4618393ee2369dcec2cb2 /lib/compiler_rt/log.zig | |
| parent | 7abb170f59ed959c4004ec37258c8905903f36b1 (diff) | |
| download | zig-03dfd2ecc37cc99b15d4ce3ff19147230ddc8fd4.tar.gz zig-03dfd2ecc37cc99b15d4ce3ff19147230ddc8fd4.zip | |
Make sure to test the sign of the zero results
Diffstat (limited to 'lib/compiler_rt/log.zig')
| -rw-r--r-- | lib/compiler_rt/log.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/compiler_rt/log.zig b/lib/compiler_rt/log.zig index e7c98547e7..f8bbf430ac 100644 --- a/lib/compiler_rt/log.zig +++ b/lib/compiler_rt/log.zig @@ -163,7 +163,7 @@ pub fn logl(x: c_longdouble) callconv(.c) c_longdouble { test "logf() special" { try expectEqual(logf(0.0), -math.inf(f32)); try expectEqual(logf(-0.0), -math.inf(f32)); - try expectEqual(logf(1.0), 0.0); + try expect(math.isPositiveZero(logf(1.0))); try expectEqual(logf(math.e), 1.0); try expectEqual(logf(math.inf(f32)), math.inf(f32)); try expect(math.isNan(logf(-1.0))); @@ -198,7 +198,7 @@ test "logf() boundary" { test "log() special" { try expectEqual(log(0.0), -math.inf(f64)); try expectEqual(log(-0.0), -math.inf(f64)); - try expectEqual(log(1.0), 0.0); + try expect(math.isPositiveZero(log(1.0))); try expectEqual(log(math.e), 1.0); try expectEqual(log(math.inf(f64)), math.inf(f64)); try expect(math.isNan(log(-1.0))); |
