float

std.math.float

fun sqrt_f32

pub fun sqrt_f32(x: f32) f32;

非负标量的平方根

在双精度下进行牛顿迭代法优化,精度低于一个 f32 ulp;硬件 sqrt 等待编译器中支持 SIMD 的内联汇编编码器。

x:非负值 ret:sqrt(x),或当 x == 0 时返回 0

fun rsqrt_f32

pub fun rsqrt_f32(x: f32) f32;

正标量的平方根倒数

x:正值 ret:1 / sqrt(x)

fun sin_f32

pub fun sin_f32(x: f32) f32;

弧度的正弦值

x:弧度角 ret:sin(x)

fun cos_f32

pub fun cos_f32(x: f32) f32;

弧度的余弦值

x:弧度角 ret:cos(x)

fun asin_f32

pub fun asin_f32(x: f32) f32;

值在 [-1, 1] 中的反正弦值

x:值在 [-1, 1] 范围内 ret:asin(x),范围在 [-pi/2, pi/2]

fun acos_f32

pub fun acos_f32(x: f32) f32;

值在 [-1, 1] 中的反余弦值

x:值在 [-1, 1] 范围内 ret:acos(x),范围在 [0, pi]