std.math.complex: tighten existing test bounds
This commit is contained in:
@@ -13,12 +13,11 @@ pub fn log(z: anytype) Complex(@TypeOf(z.re, z.im)) {
|
||||
return Complex(T).init(@log(r), phi);
|
||||
}
|
||||
|
||||
const epsilon = 0.0001;
|
||||
|
||||
test log {
|
||||
const epsilon = math.floatEps(f32);
|
||||
const a = Complex(f32).init(5, 3);
|
||||
const c = log(a);
|
||||
|
||||
try testing.expect(math.approxEqAbs(f32, c.re, 1.763180, epsilon));
|
||||
try testing.expect(math.approxEqAbs(f32, c.im, 0.540419, epsilon));
|
||||
try testing.expectApproxEqAbs(1.7631803, c.re, epsilon);
|
||||
try testing.expectApproxEqAbs(0.5404195, c.im, epsilon);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user