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

asinBinary64Vec

Private Function
std.math.asin.asinBinary64Vec
fn asinBinary64Vec(comptime vec_len: comptime_int, x: @Vector(vec_len, f64)) @TypeOf(x)

Params

  • vec_len: comptime_int
  • x: @Vector(vec_len, f64)

File

math/asin.zig:480
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
fn asinBinary64Vec(comptime vec_len: comptime_int, x: @Vector(vec_len, f64)) @TypeOf(x) {
    const pi_over_2: @Vector(vec_len, f64) = @splat(math.pi / 2.0);
    const zero: @Vector(vec_len, f64) = @splat(0.0);
    const half: @Vector(vec_len, f64) = @splat(0.5);
    const neg_two: @Vector(vec_len, f64) = @splat(-2.0);
    const c0: @Vector(vec_len, f64) = @splat(0x1.555555555554ep-3);
    const c1: @Vector(vec_len, f64) = @splat(0x1.3333333337233p-4);
    const c2: @Vector(vec_len, f64) = @splat(0x1.6db6db67f6d9fp-5);
    const c3: @Vector(vec_len, f64) = @splat(0x1.f1c71fbd29fbbp-6);
    const c4: @Vector(vec_len, f64) = @splat(0x1.6e8b264d467d6p-6);
    const c5: @Vector(vec_len, f64) = @splat(0x1.1c5997c357e9dp-6);
    const c6: @Vector(vec_len, f64) = @splat(0x1.c86a22cd9389dp-7);
    const c7: @Vector(vec_len, f64) = @splat(0x1.856073c22ebbep-7);
    const c8: @Vector(vec_len, f64) = @splat(0x1.fd1151acb6bedp-8);
    const c9: @Vector(vec_len, f64) = @splat(0x1.087182f799c1dp-6);
    const c10: @Vector(vec_len, f64) = @splat(-0x1.6602748120927p-7);
    const c11: @Vector(vec_len, f64) = @splat(0x1.cfa0dd1f9478p-6);

    const ax = @abs(x);
    const ax_lt_half = ax < half;
    const z2 = @select(f64, ax_lt_half, x * x, @mulAdd(@Vector(vec_len, f64), -half, ax, half));
    const z = @select(f64, ax_lt_half, ax, @sqrt(z2));
    const z3 = z2 * z;
    const z4 = z2 * z2;
    const z8 = z4 * z4;
    const p0_1 = @mulAdd(@Vector(vec_len, f64), z2, c1, c0);
    const p2_3 = @mulAdd(@Vector(vec_len, f64), z2, c3, c2);
    const p0_3 = @mulAdd(@Vector(vec_len, f64), z4, p2_3, p0_1);
    const p4_5 = @mulAdd(@Vector(vec_len, f64), z2, c5, c4);
    const p6_7 = @mulAdd(@Vector(vec_len, f64), z2, c7, c6);
    const p4_7 = @mulAdd(@Vector(vec_len, f64), z4, p6_7, p4_5);
    const p8_9 = @mulAdd(@Vector(vec_len, f64), z2, c9, c8);
    const p10_11 = @mulAdd(@Vector(vec_len, f64), z2, c11, c10);
    const p8_11 = @mulAdd(@Vector(vec_len, f64), z4, p10_11, p8_9);
    const p4_11 = @mulAdd(@Vector(vec_len, f64), z8, p8_11, p4_7);
    const p0_11 = @mulAdd(@Vector(vec_len, f64), z8, p4_11, p0_3);
    const p = @mulAdd(@Vector(vec_len, f64), z3, p0_11, z);
    const y = @select(f64, ax_lt_half, p, @mulAdd(@Vector(vec_len, f64), p, neg_two, pi_over_2));
    return @select(f64, x < zero, -y, y);
}