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.

cosx

trig.cosx
pub fn cosx(x: f80, y: f80) f80

File

lib/compiler_rt/trig.zig:83

Code

pub fn cosx(x: f80, y: f80) f80 {
    const C1: f80 = 0.0416666666666666666136;
    const C2: f64 = -0.0013888888888888874;
    const C3: f64 = 0.000024801587301571716;
    const C4: f64 = -0.00000027557319215507120;
    const C5: f64 = 0.0000000020876754400407278;
    const C6: f64 = -1.1470297442401303e-11;
    const C7: f64 = 4.7383039476436467e-14;

    const z = x * x;
    const r = z * (C1 + z * (C2 + z * (C3 + z * (C4 +
        z * (C5 + z * (C6 + z * C7))))));
    const hz = 0.5 * z;
    const w = 1.0 - hz;

    return w + (((1.0 - w) - hz) + (z * r - x * y));
}