Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

testTanNormal

tan.testTanNormal
fn testTanNormal(comptime T: type) !void

File

lib/compiler_rt/tan.zig:174

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);
}