fn asinBinary16(x: f16) f16
fn asinBinary16(x: f16) f16 { const pio2: f32 = math.pi / 2.0; const hx: u16 = @bitCast(x); const ix = hx & 0x7fff; // |x| >= 1 if (ix >= 0x3c00) { // |x| == 1 if (ix == 0x3c00) { // asin(+-1) = +-pi/2 with inexact return @floatCast(x * pio2 + 0x1.0p-120); } // asin(|x| > 1) is nan return 0.0 / (x - x); } // |x| < 0.5 if (ix < 0x3800) { return @floatCast(x * approxBinary16(x * x)); } // 1 > |x| >= 0.5 const z = (1.0 - @abs(x)) * 0.5; const s = @sqrt(z); const x_local = pio2 - 2.0 * s * approxBinary16(z); if (hx >> 15 != 0) { return @floatCast(-x_local); } return @floatCast(x_local); }