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

ldexp_cexp64

Private Function
std.math.complex.ldexp.ldexp_cexp64
fn ldexp_cexp64(z: Complex(f64), expt: i32) Complex(f64)

Params

File

math/complex/ldexp.zig:69
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
fn ldexp_cexp64(z: Complex(f64), expt: i32) Complex(f64) {
    var ex_expt: i32 = undefined;
    const exp_x = frexp_exp64(z.re, &ex_expt);
    const exptf = @as(i64, expt + ex_expt);

    const half_expt1 = @divTrunc(exptf, 2);
    const scale1 = @as(f64, @bitCast((0x3ff + half_expt1) << (20 + 32)));

    const half_expt2 = exptf - half_expt1;
    const scale2 = @as(f64, @bitCast((0x3ff + half_expt2) << (20 + 32)));

    return Complex(f64).init(
        @cos(z.im) * exp_x * scale1 * scale2,
        @sin(z.im) * exp_x * scale1 * scale2,
    );
}