Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Private Function

rationalApproxBinary32

Private Function
std.math.acos.rationalApproxBinary32
fn rationalApproxBinary32(z: f32) f32

Params

  • z: f32

File

math/acos.zig:92
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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);
}