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.

fmaf

fma.fmaf
pub fn fmaf(x: f32, y: f32, z: f32) callconv(.c) f32

File

Code

pub fn fmaf(x: f32, y: f32, z: f32) callconv(.c) f32 {
    const xy = @as(f64, x) * y;
    const xy_z = xy + z;
    const u = @as(u64, @bitCast(xy_z));
    const e = (u >> 52) & 0x7FF;

    if ((u & 0x1FFFFFFF) != 0x10000000 or e == 0x7FF or (xy_z - xy == z and xy_z - z == xy)) {
        return @floatCast(xy_z);
    } else {
        // TODO: Handle inexact case with double-rounding
        return @floatCast(xy_z);
    }
}