Make sure to test the sign of the zero results

This commit is contained in:
Lewis Gaul
2024-05-25 23:05:20 +01:00
committed by Andrew Kelley
parent 7abb170f59
commit 03dfd2ecc3
7 changed files with 18 additions and 18 deletions

View File

@@ -288,8 +288,8 @@ fn expm1_64(x_: f64) f64 {
}
test "expm1_32() special" {
try expectEqual(expm1_32(0.0), 0.0);
try expectEqual(expm1_32(-0.0), 0.0);
try expect(math.isPositiveZero(expm1_32(0.0)));
try expect(math.isNegativeZero(expm1_32(-0.0)));
try expectEqual(expm1_32(math.ln2), 1.0);
try expectEqual(expm1_32(math.inf(f32)), math.inf(f32));
try expectEqual(expm1_32(-math.inf(f32)), -1.0);
@@ -326,8 +326,8 @@ test "expm1_32() boundary" {
}
test "expm1_64() special" {
try expectEqual(expm1_64(0.0), 0.0);
try expectEqual(expm1_64(-0.0), 0.0);
try expect(math.isPositiveZero(expm1_64(0.0)));
try expect(math.isNegativeZero(expm1_64(-0.0)));
try expectEqual(expm1_64(math.ln2), 1.0);
try expectEqual(expm1_64(math.inf(f64)), math.inf(f64));
try expectEqual(expm1_64(-math.inf(f64)), -1.0);

View File

@@ -184,8 +184,8 @@ fn log1p_64(x: f64) f64 {
}
test "log1p_32() special" {
try expectEqual(log1p_32(0.0), 0.0);
try expectEqual(log1p_32(-0.0), 0.0);
try expect(math.isPositiveZero(log1p_32(0.0)));
try expect(math.isNegativeZero(log1p_32(-0.0)));
try expectEqual(log1p_32(-1.0), -math.inf(f32));
try expectEqual(log1p_32(1.0), math.ln2);
try expectEqual(log1p_32(math.inf(f32)), math.inf(f32));
@@ -219,8 +219,8 @@ test "log1p_32() boundary" {
}
test "log1p_64() special" {
try expectEqual(log1p_64(0.0), 0.0);
try expectEqual(log1p_64(-0.0), 0.0);
try expect(math.isPositiveZero(log1p_64(0.0)));
try expect(math.isNegativeZero(log1p_64(-0.0)));
try expectEqual(log1p_64(-1.0), -math.inf(f64));
try expectEqual(log1p_64(1.0), math.ln2);
try expectEqual(log1p_64(math.inf(f64)), math.inf(f64));