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.

exp2

Computes 2^x

exp_f128.exp2
pub fn exp2(x: f128) callconv(.c) f128

File

lib/compiler_rt/exp_f128.zig:94

Code

pub fn exp2(x: f128) callconv(.c) f128 {
    if (!math.isFinite(x)) {
        if (math.isNan(x)) {
            if (math.isSignalNan(x)) math.raiseInvalid();
            return math.nan(f128);
        }
        return if (math.signbit(x)) 0 else x;
    }
    if (@abs(x) > 17000) {
        if (math.signbit(x)) {
            math.raiseUnderflow();
            return 0;
        } else {
            math.raiseOverflow();
            return math.inf(f128);
        }
    }
    if (@abs(x) < 0x1p-114 * math.log2e)
        return 1 + x;

    return proc1(cfg_2, x);
}