feature. See also
. The project being documented here (as the example) is the Zig library itself.
tan.testTanNormal
fn testTanNormal(comptime T: type) !void
File
Code
fn testTanNormal(comptime T: type) !void {
const f = switch (T) {
f32 => tanf,
f64 => tan,
else => @compileError("unimplemented"),
};
const epsilon = 0.00001;
try expectApproxEqAbs(@as(T, 0.0), f(0.0), epsilon);
try expectApproxEqAbs(@as(T, 0.202710), f(0.2), epsilon);
try expectApproxEqAbs(@as(T, 1.240422), f(0.8923), epsilon);
try expectApproxEqAbs(@as(T, 14.101420), f(1.5), epsilon);
try expectApproxEqAbs(@as(T, -0.254397), f(37.45), epsilon);
try expectApproxEqAbs(@as(T, 2.285837), f(89.123), epsilon);
}