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.

cosq

trig.cosq
pub fn cosq(x: f128, y: f128) f128

File

lib/compiler_rt/trig.zig:101

Code

pub fn cosq(x: f128, y: f128) f128 {
    const C1: f128 = 0.04166666666666666666666666666666658424671;
    const C2: f128 = -0.001388888888888888888888888888863490893732;
    const C3: f128 = 0.00002480158730158730158730158600795304914210;
    const C4: f128 = -0.2755731922398589065255474947078934284324e-6;
    const C5: f128 = 0.2087675698786809897659225313136400793948e-8;
    const C6: f128 = -0.1147074559772972315817149986812031204775e-10;
    const C7: f128 = 0.4779477332386808976875457937252120293400e-13;
    const C8: f64 = -0.1561920696721507929516718307820958119868e-15;
    const C9: f64 = 0.4110317413744594971475941557607804508039e-18;
    const C10: f64 = -0.8896592467191938803288521958313920156409e-21;
    const C11: f64 = 0.1601061435794535138244346256065192782581e-23;

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

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