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.

sinx

trig.sinx
pub fn sinx(x: f80, y: f80, iy: i32) f80

File

lib/compiler_rt/trig.zig:184

Code

pub fn sinx(x: f80, y: f80, iy: i32) f80 {
    const S1: f80 = -0.166666666666666666671;
    const S2: f64 = 0.0083333333333333332;
    const S3: f64 = -0.00019841269841269427;
    const S4: f64 = 0.0000027557319223597490;
    const S5: f64 = -0.000000025052108218074604;
    const S6: f64 = 1.6059006598854211e-10;
    const S7: f64 = -7.6429779983024564e-13;
    const S8: f64 = 2.6174587166648325e-15;

    const z = x * x;
    const v = z * x;
    const r = S2 + z * (S3 + z * (S4 + z * (S5 +
        z * (S6 + z * (S7 + z * S8)))));

    if (iy == 0)
        return x + v * (S1 + z * r);

    return x - ((z * (0.5 * y - v * r) - y) - v * S1);
}