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.

rationalApproxBinary32

acos.rationalApproxBinary32
fn rationalApproxBinary32(z: f32) f32

File

lib/std/math/acos.zig:92

Code

fn rationalApproxBinary32(z: f32) f32 {
    const pS0: f32 = 1.6666586697e-01;
    const pS1: f32 = -4.2743422091e-02;
    const pS2: f32 = -8.6563630030e-03;
    const qS1: f32 = -7.0662963390e-01;

    // f64 is used instead of f32 to avoid
    // a vectorization on x86_64. The vectorization
    // causes extra floating point execeptions
    // that are prohibited by libc-test.
    const p: f64 = @as(f64, @floatCast(z)) * (pS0 + z * (pS1 + z * pS2));
    const q: f64 = 1.0 + z * qS1;
    return @floatCast(p / q);
}