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

frexp_exp64

Private Function
std.math.complex.ldexp.frexp_exp64
fn frexp_exp64(x: f64, expt: *i32) f64

Params

  • x: f64
  • expt: *i32

File

math/complex/ldexp.zig:53
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
fn frexp_exp64(x: f64, expt: *i32) f64 {
    const k = 1799; // reduction constant
    const kln2 = 1246.97177782734161156; // k * ln2

    const exp_x = @exp(x - kln2);

    const fx = @as(u64, @bitCast(exp_x));
    const hx = @as(u32, @intCast(fx >> 32));
    const lx = @as(u32, @truncate(fx));

    expt.* = @as(i32, @intCast(hx >> 20)) - (0x3ff + 1023) + k;

    const high_word = (hx & 0xfffff) | ((0x3ff + 1023) << 20);
    return @as(f64, @bitCast((@as(u64, high_word) << 32) | lx));
}