|
@@ -96,96 +96,96 @@ foreign _ {
|
|
ldexp_f64 :: proc(val: f64, exp: i32) -> f64 ---
|
|
ldexp_f64 :: proc(val: f64, exp: i32) -> f64 ---
|
|
}
|
|
}
|
|
|
|
|
|
-sqrt_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(sqrt_f16(f16(x))); }
|
|
|
|
-sqrt_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(sqrt_f16(f16(x))); }
|
|
|
|
-sqrt_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(sqrt_f32(f32(x))); }
|
|
|
|
-sqrt_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(sqrt_f32(f32(x))); }
|
|
|
|
-sqrt_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(sqrt_f64(f64(x))); }
|
|
|
|
-sqrt_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(sqrt_f64(f64(x))); }
|
|
|
|
|
|
+sqrt_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(sqrt_f16(f16(x))) }
|
|
|
|
+sqrt_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(sqrt_f16(f16(x))) }
|
|
|
|
+sqrt_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(sqrt_f32(f32(x))) }
|
|
|
|
+sqrt_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(sqrt_f32(f32(x))) }
|
|
|
|
+sqrt_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(sqrt_f64(f64(x))) }
|
|
|
|
+sqrt_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(sqrt_f64(f64(x))) }
|
|
sqrt :: proc{
|
|
sqrt :: proc{
|
|
sqrt_f16, sqrt_f16le, sqrt_f16be,
|
|
sqrt_f16, sqrt_f16le, sqrt_f16be,
|
|
sqrt_f32, sqrt_f32le, sqrt_f32be,
|
|
sqrt_f32, sqrt_f32le, sqrt_f32be,
|
|
sqrt_f64, sqrt_f64le, sqrt_f64be,
|
|
sqrt_f64, sqrt_f64le, sqrt_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-sin_f16le :: proc(θ: f16le) -> f16le { return #force_inline f16le(sin_f16(f16(θ))); }
|
|
|
|
-sin_f16be :: proc(θ: f16be) -> f16be { return #force_inline f16be(sin_f16(f16(θ))); }
|
|
|
|
-sin_f32le :: proc(θ: f32le) -> f32le { return #force_inline f32le(sin_f32(f32(θ))); }
|
|
|
|
-sin_f32be :: proc(θ: f32be) -> f32be { return #force_inline f32be(sin_f32(f32(θ))); }
|
|
|
|
-sin_f64le :: proc(θ: f64le) -> f64le { return #force_inline f64le(sin_f64(f64(θ))); }
|
|
|
|
-sin_f64be :: proc(θ: f64be) -> f64be { return #force_inline f64be(sin_f64(f64(θ))); }
|
|
|
|
|
|
+sin_f16le :: proc(θ: f16le) -> f16le { return #force_inline f16le(sin_f16(f16(θ))) }
|
|
|
|
+sin_f16be :: proc(θ: f16be) -> f16be { return #force_inline f16be(sin_f16(f16(θ))) }
|
|
|
|
+sin_f32le :: proc(θ: f32le) -> f32le { return #force_inline f32le(sin_f32(f32(θ))) }
|
|
|
|
+sin_f32be :: proc(θ: f32be) -> f32be { return #force_inline f32be(sin_f32(f32(θ))) }
|
|
|
|
+sin_f64le :: proc(θ: f64le) -> f64le { return #force_inline f64le(sin_f64(f64(θ))) }
|
|
|
|
+sin_f64be :: proc(θ: f64be) -> f64be { return #force_inline f64be(sin_f64(f64(θ))) }
|
|
sin :: proc{
|
|
sin :: proc{
|
|
sin_f16, sin_f16le, sin_f16be,
|
|
sin_f16, sin_f16le, sin_f16be,
|
|
sin_f32, sin_f32le, sin_f32be,
|
|
sin_f32, sin_f32le, sin_f32be,
|
|
sin_f64, sin_f64le, sin_f64be,
|
|
sin_f64, sin_f64le, sin_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-cos_f16le :: proc(θ: f16le) -> f16le { return #force_inline f16le(cos_f16(f16(θ))); }
|
|
|
|
-cos_f16be :: proc(θ: f16be) -> f16be { return #force_inline f16be(cos_f16(f16(θ))); }
|
|
|
|
-cos_f32le :: proc(θ: f32le) -> f32le { return #force_inline f32le(cos_f32(f32(θ))); }
|
|
|
|
-cos_f32be :: proc(θ: f32be) -> f32be { return #force_inline f32be(cos_f32(f32(θ))); }
|
|
|
|
-cos_f64le :: proc(θ: f64le) -> f64le { return #force_inline f64le(cos_f64(f64(θ))); }
|
|
|
|
-cos_f64be :: proc(θ: f64be) -> f64be { return #force_inline f64be(cos_f64(f64(θ))); }
|
|
|
|
|
|
+cos_f16le :: proc(θ: f16le) -> f16le { return #force_inline f16le(cos_f16(f16(θ))) }
|
|
|
|
+cos_f16be :: proc(θ: f16be) -> f16be { return #force_inline f16be(cos_f16(f16(θ))) }
|
|
|
|
+cos_f32le :: proc(θ: f32le) -> f32le { return #force_inline f32le(cos_f32(f32(θ))) }
|
|
|
|
+cos_f32be :: proc(θ: f32be) -> f32be { return #force_inline f32be(cos_f32(f32(θ))) }
|
|
|
|
+cos_f64le :: proc(θ: f64le) -> f64le { return #force_inline f64le(cos_f64(f64(θ))) }
|
|
|
|
+cos_f64be :: proc(θ: f64be) -> f64be { return #force_inline f64be(cos_f64(f64(θ))) }
|
|
cos :: proc{
|
|
cos :: proc{
|
|
cos_f16, cos_f16le, cos_f16be,
|
|
cos_f16, cos_f16le, cos_f16be,
|
|
cos_f32, cos_f32le, cos_f32be,
|
|
cos_f32, cos_f32le, cos_f32be,
|
|
cos_f64, cos_f64le, cos_f64be,
|
|
cos_f64, cos_f64le, cos_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-pow_f16le :: proc(x, power: f16le) -> f16le { return #force_inline f16le(pow_f16(f16(x), f16(power))); }
|
|
|
|
-pow_f16be :: proc(x, power: f16be) -> f16be { return #force_inline f16be(pow_f16(f16(x), f16(power))); }
|
|
|
|
-pow_f32le :: proc(x, power: f32le) -> f32le { return #force_inline f32le(pow_f32(f32(x), f32(power))); }
|
|
|
|
-pow_f32be :: proc(x, power: f32be) -> f32be { return #force_inline f32be(pow_f32(f32(x), f32(power))); }
|
|
|
|
-pow_f64le :: proc(x, power: f64le) -> f64le { return #force_inline f64le(pow_f64(f64(x), f64(power))); }
|
|
|
|
-pow_f64be :: proc(x, power: f64be) -> f64be { return #force_inline f64be(pow_f64(f64(x), f64(power))); }
|
|
|
|
|
|
+pow_f16le :: proc(x, power: f16le) -> f16le { return #force_inline f16le(pow_f16(f16(x), f16(power))) }
|
|
|
|
+pow_f16be :: proc(x, power: f16be) -> f16be { return #force_inline f16be(pow_f16(f16(x), f16(power))) }
|
|
|
|
+pow_f32le :: proc(x, power: f32le) -> f32le { return #force_inline f32le(pow_f32(f32(x), f32(power))) }
|
|
|
|
+pow_f32be :: proc(x, power: f32be) -> f32be { return #force_inline f32be(pow_f32(f32(x), f32(power))) }
|
|
|
|
+pow_f64le :: proc(x, power: f64le) -> f64le { return #force_inline f64le(pow_f64(f64(x), f64(power))) }
|
|
|
|
+pow_f64be :: proc(x, power: f64be) -> f64be { return #force_inline f64be(pow_f64(f64(x), f64(power))) }
|
|
pow :: proc{
|
|
pow :: proc{
|
|
pow_f16, pow_f16le, pow_f16be,
|
|
pow_f16, pow_f16le, pow_f16be,
|
|
pow_f32, pow_f32le, pow_f32be,
|
|
pow_f32, pow_f32le, pow_f32be,
|
|
pow_f64, pow_f64le, pow_f64be,
|
|
pow_f64, pow_f64le, pow_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-fmuladd_f16le :: proc(a, b, c: f16le) -> f16le { return #force_inline f16le(fmuladd_f16(f16(a), f16(b), f16(c))); }
|
|
|
|
-fmuladd_f16be :: proc(a, b, c: f16be) -> f16be { return #force_inline f16be(fmuladd_f16(f16(a), f16(b), f16(c))); }
|
|
|
|
-fmuladd_f32le :: proc(a, b, c: f32le) -> f32le { return #force_inline f32le(fmuladd_f32(f32(a), f32(b), f32(c))); }
|
|
|
|
-fmuladd_f32be :: proc(a, b, c: f32be) -> f32be { return #force_inline f32be(fmuladd_f32(f32(a), f32(b), f32(c))); }
|
|
|
|
-fmuladd_f64le :: proc(a, b, c: f64le) -> f64le { return #force_inline f64le(fmuladd_f64(f64(a), f64(b), f64(c))); }
|
|
|
|
-fmuladd_f64be :: proc(a, b, c: f64be) -> f64be { return #force_inline f64be(fmuladd_f64(f64(a), f64(b), f64(c))); }
|
|
|
|
|
|
+fmuladd_f16le :: proc(a, b, c: f16le) -> f16le { return #force_inline f16le(fmuladd_f16(f16(a), f16(b), f16(c))) }
|
|
|
|
+fmuladd_f16be :: proc(a, b, c: f16be) -> f16be { return #force_inline f16be(fmuladd_f16(f16(a), f16(b), f16(c))) }
|
|
|
|
+fmuladd_f32le :: proc(a, b, c: f32le) -> f32le { return #force_inline f32le(fmuladd_f32(f32(a), f32(b), f32(c))) }
|
|
|
|
+fmuladd_f32be :: proc(a, b, c: f32be) -> f32be { return #force_inline f32be(fmuladd_f32(f32(a), f32(b), f32(c))) }
|
|
|
|
+fmuladd_f64le :: proc(a, b, c: f64le) -> f64le { return #force_inline f64le(fmuladd_f64(f64(a), f64(b), f64(c))) }
|
|
|
|
+fmuladd_f64be :: proc(a, b, c: f64be) -> f64be { return #force_inline f64be(fmuladd_f64(f64(a), f64(b), f64(c))) }
|
|
fmuladd :: proc{
|
|
fmuladd :: proc{
|
|
fmuladd_f16, fmuladd_f16le, fmuladd_f16be,
|
|
fmuladd_f16, fmuladd_f16le, fmuladd_f16be,
|
|
fmuladd_f32, fmuladd_f32le, fmuladd_f32be,
|
|
fmuladd_f32, fmuladd_f32le, fmuladd_f32be,
|
|
fmuladd_f64, fmuladd_f64le, fmuladd_f64be,
|
|
fmuladd_f64, fmuladd_f64le, fmuladd_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-ln_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(ln_f16(f16(x))); }
|
|
|
|
-ln_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(ln_f16(f16(x))); }
|
|
|
|
-ln_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(ln_f32(f32(x))); }
|
|
|
|
-ln_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(ln_f32(f32(x))); }
|
|
|
|
-ln_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(ln_f64(f64(x))); }
|
|
|
|
-ln_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(ln_f64(f64(x))); }
|
|
|
|
|
|
+ln_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(ln_f16(f16(x))) }
|
|
|
|
+ln_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(ln_f16(f16(x))) }
|
|
|
|
+ln_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(ln_f32(f32(x))) }
|
|
|
|
+ln_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(ln_f32(f32(x))) }
|
|
|
|
+ln_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(ln_f64(f64(x))) }
|
|
|
|
+ln_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(ln_f64(f64(x))) }
|
|
ln :: proc{
|
|
ln :: proc{
|
|
ln_f16, ln_f16le, ln_f16be,
|
|
ln_f16, ln_f16le, ln_f16be,
|
|
ln_f32, ln_f32le, ln_f32be,
|
|
ln_f32, ln_f32le, ln_f32be,
|
|
ln_f64, ln_f64le, ln_f64be,
|
|
ln_f64, ln_f64le, ln_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-exp_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(exp_f16(f16(x))); }
|
|
|
|
-exp_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(exp_f16(f16(x))); }
|
|
|
|
-exp_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(exp_f32(f32(x))); }
|
|
|
|
-exp_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(exp_f32(f32(x))); }
|
|
|
|
-exp_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(exp_f64(f64(x))); }
|
|
|
|
-exp_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(exp_f64(f64(x))); }
|
|
|
|
|
|
+exp_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(exp_f16(f16(x))) }
|
|
|
|
+exp_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(exp_f16(f16(x))) }
|
|
|
|
+exp_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(exp_f32(f32(x))) }
|
|
|
|
+exp_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(exp_f32(f32(x))) }
|
|
|
|
+exp_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(exp_f64(f64(x))) }
|
|
|
|
+exp_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(exp_f64(f64(x))) }
|
|
exp :: proc{
|
|
exp :: proc{
|
|
exp_f16, exp_f16le, exp_f16be,
|
|
exp_f16, exp_f16le, exp_f16be,
|
|
exp_f32, exp_f32le, exp_f32be,
|
|
exp_f32, exp_f32le, exp_f32be,
|
|
exp_f64, exp_f64le, exp_f64be,
|
|
exp_f64, exp_f64le, exp_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-ldexp_f16le :: proc(val: f16le, exp: i32) -> f16le { return #force_inline f16le(ldexp_f16(f16(val), exp)); }
|
|
|
|
-ldexp_f16be :: proc(val: f16be, exp: i32) -> f16be { return #force_inline f16be(ldexp_f16(f16(val), exp)); }
|
|
|
|
-ldexp_f32le :: proc(val: f32le, exp: i32) -> f32le { return #force_inline f32le(ldexp_f32(f32(val), exp)); }
|
|
|
|
-ldexp_f32be :: proc(val: f32be, exp: i32) -> f32be { return #force_inline f32be(ldexp_f32(f32(val), exp)); }
|
|
|
|
-ldexp_f64le :: proc(val: f64le, exp: i32) -> f64le { return #force_inline f64le(ldexp_f64(f64(val), exp)); }
|
|
|
|
-ldexp_f64be :: proc(val: f64be, exp: i32) -> f64be { return #force_inline f64be(ldexp_f64(f64(val), exp)); }
|
|
|
|
|
|
+ldexp_f16le :: proc(val: f16le, exp: i32) -> f16le { return #force_inline f16le(ldexp_f16(f16(val), exp)) }
|
|
|
|
+ldexp_f16be :: proc(val: f16be, exp: i32) -> f16be { return #force_inline f16be(ldexp_f16(f16(val), exp)) }
|
|
|
|
+ldexp_f32le :: proc(val: f32le, exp: i32) -> f32le { return #force_inline f32le(ldexp_f32(f32(val), exp)) }
|
|
|
|
+ldexp_f32be :: proc(val: f32be, exp: i32) -> f32be { return #force_inline f32be(ldexp_f32(f32(val), exp)) }
|
|
|
|
+ldexp_f64le :: proc(val: f64le, exp: i32) -> f64le { return #force_inline f64le(ldexp_f64(f64(val), exp)) }
|
|
|
|
+ldexp_f64be :: proc(val: f64be, exp: i32) -> f64be { return #force_inline f64be(ldexp_f64(f64(val), exp)) }
|
|
ldexp :: proc{
|
|
ldexp :: proc{
|
|
ldexp_f16, ldexp_f16le, ldexp_f16be,
|
|
ldexp_f16, ldexp_f16le, ldexp_f16be,
|
|
ldexp_f32, ldexp_f32le, ldexp_f32be,
|
|
ldexp_f32, ldexp_f32le, ldexp_f32be,
|
|
@@ -193,76 +193,76 @@ ldexp :: proc{
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-log_f16 :: proc(x, base: f16) -> f16 { return ln(x) / ln(base); }
|
|
|
|
-log_f16le :: proc(x, base: f16le) -> f16le { return f16le(log_f16(f16(x), f16(base))); }
|
|
|
|
-log_f16be :: proc(x, base: f16be) -> f16be { return f16be(log_f16(f16(x), f16(base))); }
|
|
|
|
|
|
+log_f16 :: proc(x, base: f16) -> f16 { return ln(x) / ln(base) }
|
|
|
|
+log_f16le :: proc(x, base: f16le) -> f16le { return f16le(log_f16(f16(x), f16(base))) }
|
|
|
|
+log_f16be :: proc(x, base: f16be) -> f16be { return f16be(log_f16(f16(x), f16(base))) }
|
|
|
|
|
|
-log_f32 :: proc(x, base: f32) -> f32 { return ln(x) / ln(base); }
|
|
|
|
-log_f32le :: proc(x, base: f32le) -> f32le { return f32le(log_f32(f32(x), f32(base))); }
|
|
|
|
-log_f32be :: proc(x, base: f32be) -> f32be { return f32be(log_f32(f32(x), f32(base))); }
|
|
|
|
|
|
+log_f32 :: proc(x, base: f32) -> f32 { return ln(x) / ln(base) }
|
|
|
|
+log_f32le :: proc(x, base: f32le) -> f32le { return f32le(log_f32(f32(x), f32(base))) }
|
|
|
|
+log_f32be :: proc(x, base: f32be) -> f32be { return f32be(log_f32(f32(x), f32(base))) }
|
|
|
|
|
|
-log_f64 :: proc(x, base: f64) -> f64 { return ln(x) / ln(base); }
|
|
|
|
-log_f64le :: proc(x, base: f64le) -> f64le { return f64le(log_f64(f64(x), f64(base))); }
|
|
|
|
-log_f64be :: proc(x, base: f64be) -> f64be { return f64be(log_f64(f64(x), f64(base))); }
|
|
|
|
|
|
+log_f64 :: proc(x, base: f64) -> f64 { return ln(x) / ln(base) }
|
|
|
|
+log_f64le :: proc(x, base: f64le) -> f64le { return f64le(log_f64(f64(x), f64(base))) }
|
|
|
|
+log_f64be :: proc(x, base: f64be) -> f64be { return f64be(log_f64(f64(x), f64(base))) }
|
|
log :: proc{
|
|
log :: proc{
|
|
log_f16, log_f16le, log_f16be,
|
|
log_f16, log_f16le, log_f16be,
|
|
log_f32, log_f32le, log_f32be,
|
|
log_f32, log_f32le, log_f32be,
|
|
log_f64, log_f64le, log_f64be,
|
|
log_f64, log_f64le, log_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-log2_f16 :: proc(x: f16) -> f16 { return ln(x)/LN2; }
|
|
|
|
-log2_f16le :: proc(x: f16le) -> f16le { return f16le(log2_f16(f16(x))); }
|
|
|
|
-log2_f16be :: proc(x: f16be) -> f16be { return f16be(log2_f16(f16(x))); }
|
|
|
|
|
|
+log2_f16 :: proc(x: f16) -> f16 { return ln(x)/LN2 }
|
|
|
|
+log2_f16le :: proc(x: f16le) -> f16le { return f16le(log2_f16(f16(x))) }
|
|
|
|
+log2_f16be :: proc(x: f16be) -> f16be { return f16be(log2_f16(f16(x))) }
|
|
|
|
|
|
-log2_f32 :: proc(x: f32) -> f32 { return ln(x)/LN2; }
|
|
|
|
-log2_f32le :: proc(x: f32le) -> f32le { return f32le(log2_f32(f32(x))); }
|
|
|
|
-log2_f32be :: proc(x: f32be) -> f32be { return f32be(log2_f32(f32(x))); }
|
|
|
|
|
|
+log2_f32 :: proc(x: f32) -> f32 { return ln(x)/LN2 }
|
|
|
|
+log2_f32le :: proc(x: f32le) -> f32le { return f32le(log2_f32(f32(x))) }
|
|
|
|
+log2_f32be :: proc(x: f32be) -> f32be { return f32be(log2_f32(f32(x))) }
|
|
|
|
|
|
-log2_f64 :: proc(x: f64) -> f64 { return ln(x)/LN2; }
|
|
|
|
-log2_f64le :: proc(x: f64le) -> f64le { return f64le(log2_f64(f64(x))); }
|
|
|
|
-log2_f64be :: proc(x: f64be) -> f64be { return f64be(log2_f64(f64(x))); }
|
|
|
|
|
|
+log2_f64 :: proc(x: f64) -> f64 { return ln(x)/LN2 }
|
|
|
|
+log2_f64le :: proc(x: f64le) -> f64le { return f64le(log2_f64(f64(x))) }
|
|
|
|
+log2_f64be :: proc(x: f64be) -> f64be { return f64be(log2_f64(f64(x))) }
|
|
log2 :: proc{
|
|
log2 :: proc{
|
|
log2_f16, log2_f16le, log2_f16be,
|
|
log2_f16, log2_f16le, log2_f16be,
|
|
log2_f32, log2_f32le, log2_f32be,
|
|
log2_f32, log2_f32le, log2_f32be,
|
|
log2_f64, log2_f64le, log2_f64be,
|
|
log2_f64, log2_f64le, log2_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-log10_f16 :: proc(x: f16) -> f16 { return ln(x)/LN10; }
|
|
|
|
-log10_f16le :: proc(x: f16le) -> f16le { return f16le(log10_f16(f16(x))); }
|
|
|
|
-log10_f16be :: proc(x: f16be) -> f16be { return f16be(log10_f16(f16(x))); }
|
|
|
|
|
|
+log10_f16 :: proc(x: f16) -> f16 { return ln(x)/LN10 }
|
|
|
|
+log10_f16le :: proc(x: f16le) -> f16le { return f16le(log10_f16(f16(x))) }
|
|
|
|
+log10_f16be :: proc(x: f16be) -> f16be { return f16be(log10_f16(f16(x))) }
|
|
|
|
|
|
-log10_f32 :: proc(x: f32) -> f32 { return ln(x)/LN10; }
|
|
|
|
-log10_f32le :: proc(x: f32le) -> f32le { return f32le(log10_f32(f32(x))); }
|
|
|
|
-log10_f32be :: proc(x: f32be) -> f32be { return f32be(log10_f32(f32(x))); }
|
|
|
|
|
|
+log10_f32 :: proc(x: f32) -> f32 { return ln(x)/LN10 }
|
|
|
|
+log10_f32le :: proc(x: f32le) -> f32le { return f32le(log10_f32(f32(x))) }
|
|
|
|
+log10_f32be :: proc(x: f32be) -> f32be { return f32be(log10_f32(f32(x))) }
|
|
|
|
|
|
-log10_f64 :: proc(x: f64) -> f64 { return ln(x)/LN10; }
|
|
|
|
-log10_f64le :: proc(x: f64le) -> f64le { return f64le(log10_f64(f64(x))); }
|
|
|
|
-log10_f64be :: proc(x: f64be) -> f64be { return f64be(log10_f64(f64(x))); }
|
|
|
|
|
|
+log10_f64 :: proc(x: f64) -> f64 { return ln(x)/LN10 }
|
|
|
|
+log10_f64le :: proc(x: f64le) -> f64le { return f64le(log10_f64(f64(x))) }
|
|
|
|
+log10_f64be :: proc(x: f64be) -> f64be { return f64be(log10_f64(f64(x))) }
|
|
log10 :: proc{
|
|
log10 :: proc{
|
|
log10_f16, log10_f16le, log10_f16be,
|
|
log10_f16, log10_f16le, log10_f16be,
|
|
log10_f32, log10_f32le, log10_f32be,
|
|
log10_f32, log10_f32le, log10_f32be,
|
|
log10_f64, log10_f64le, log10_f64be,
|
|
log10_f64, log10_f64le, log10_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-tan_f16 :: proc(θ: f16) -> f16 { return sin(θ)/cos(θ); }
|
|
|
|
-tan_f16le :: proc(θ: f16le) -> f16le { return f16le(tan_f16(f16(θ))); }
|
|
|
|
-tan_f16be :: proc(θ: f16be) -> f16be { return f16be(tan_f16(f16(θ))); }
|
|
|
|
|
|
+tan_f16 :: proc(θ: f16) -> f16 { return sin(θ)/cos(θ) }
|
|
|
|
+tan_f16le :: proc(θ: f16le) -> f16le { return f16le(tan_f16(f16(θ))) }
|
|
|
|
+tan_f16be :: proc(θ: f16be) -> f16be { return f16be(tan_f16(f16(θ))) }
|
|
|
|
|
|
-tan_f32 :: proc(θ: f32) -> f32 { return sin(θ)/cos(θ); }
|
|
|
|
-tan_f32le :: proc(θ: f32le) -> f32le { return f32le(tan_f32(f32(θ))); }
|
|
|
|
-tan_f32be :: proc(θ: f32be) -> f32be { return f32be(tan_f32(f32(θ))); }
|
|
|
|
|
|
+tan_f32 :: proc(θ: f32) -> f32 { return sin(θ)/cos(θ) }
|
|
|
|
+tan_f32le :: proc(θ: f32le) -> f32le { return f32le(tan_f32(f32(θ))) }
|
|
|
|
+tan_f32be :: proc(θ: f32be) -> f32be { return f32be(tan_f32(f32(θ))) }
|
|
|
|
|
|
-tan_f64 :: proc(θ: f64) -> f64 { return sin(θ)/cos(θ); }
|
|
|
|
-tan_f64le :: proc(θ: f64le) -> f64le { return f64le(tan_f64(f64(θ))); }
|
|
|
|
-tan_f64be :: proc(θ: f64be) -> f64be { return f64be(tan_f64(f64(θ))); }
|
|
|
|
|
|
+tan_f64 :: proc(θ: f64) -> f64 { return sin(θ)/cos(θ) }
|
|
|
|
+tan_f64le :: proc(θ: f64le) -> f64le { return f64le(tan_f64(f64(θ))) }
|
|
|
|
+tan_f64be :: proc(θ: f64be) -> f64be { return f64be(tan_f64(f64(θ))) }
|
|
tan :: proc{
|
|
tan :: proc{
|
|
tan_f16, tan_f16le, tan_f16be,
|
|
tan_f16, tan_f16le, tan_f16be,
|
|
tan_f32, tan_f32le, tan_f32be,
|
|
tan_f32, tan_f32le, tan_f32be,
|
|
tan_f64, tan_f64le, tan_f64be,
|
|
tan_f64, tan_f64le, tan_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-lerp :: proc(a, b: $T, t: $E) -> (x: T) { return a*(1-t) + b*t; }
|
|
|
|
-saturate :: proc(a: $T) -> (x: T) { return clamp(a, 0, 1); }
|
|
|
|
|
|
+lerp :: proc(a, b: $T, t: $E) -> (x: T) { return a*(1-t) + b*t }
|
|
|
|
+saturate :: proc(a: $T) -> (x: T) { return clamp(a, 0, 1) }
|
|
|
|
|
|
unlerp :: proc(a, b, x: $T) -> (t: T) where intrinsics.type_is_float(T), !intrinsics.type_is_array(T) {
|
|
unlerp :: proc(a, b, x: $T) -> (t: T) where intrinsics.type_is_float(T), !intrinsics.type_is_array(T) {
|
|
return (x-a)/(b-a)
|
|
return (x-a)/(b-a)
|
|
@@ -311,15 +311,15 @@ gain :: proc(t, g: $T) -> T where intrinsics.type_is_numeric(T) {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-sign_f16 :: proc(x: f16) -> f16 { return f16(int(0 < x) - int(x < 0)); }
|
|
|
|
-sign_f16le :: proc(x: f16le) -> f16le { return f16le(int(0 < x) - int(x < 0)); }
|
|
|
|
-sign_f16be :: proc(x: f16be) -> f16be { return f16be(int(0 < x) - int(x < 0)); }
|
|
|
|
-sign_f32 :: proc(x: f32) -> f32 { return f32(int(0 < x) - int(x < 0)); }
|
|
|
|
-sign_f32le :: proc(x: f32le) -> f32le { return f32le(int(0 < x) - int(x < 0)); }
|
|
|
|
-sign_f32be :: proc(x: f32be) -> f32be { return f32be(int(0 < x) - int(x < 0)); }
|
|
|
|
-sign_f64 :: proc(x: f64) -> f64 { return f64(int(0 < x) - int(x < 0)); }
|
|
|
|
-sign_f64le :: proc(x: f64le) -> f64le { return f64le(int(0 < x) - int(x < 0)); }
|
|
|
|
-sign_f64be :: proc(x: f64be) -> f64be { return f64be(int(0 < x) - int(x < 0)); }
|
|
|
|
|
|
+sign_f16 :: proc(x: f16) -> f16 { return f16(int(0 < x) - int(x < 0)) }
|
|
|
|
+sign_f16le :: proc(x: f16le) -> f16le { return f16le(int(0 < x) - int(x < 0)) }
|
|
|
|
+sign_f16be :: proc(x: f16be) -> f16be { return f16be(int(0 < x) - int(x < 0)) }
|
|
|
|
+sign_f32 :: proc(x: f32) -> f32 { return f32(int(0 < x) - int(x < 0)) }
|
|
|
|
+sign_f32le :: proc(x: f32le) -> f32le { return f32le(int(0 < x) - int(x < 0)) }
|
|
|
|
+sign_f32be :: proc(x: f32be) -> f32be { return f32be(int(0 < x) - int(x < 0)) }
|
|
|
|
+sign_f64 :: proc(x: f64) -> f64 { return f64(int(0 < x) - int(x < 0)) }
|
|
|
|
+sign_f64le :: proc(x: f64le) -> f64le { return f64le(int(0 < x) - int(x < 0)) }
|
|
|
|
+sign_f64be :: proc(x: f64be) -> f64be { return f64be(int(0 < x) - int(x < 0)) }
|
|
sign :: proc{
|
|
sign :: proc{
|
|
sign_f16, sign_f16le, sign_f16be,
|
|
sign_f16, sign_f16le, sign_f16be,
|
|
sign_f32, sign_f32le, sign_f32be,
|
|
sign_f32, sign_f32le, sign_f32be,
|
|
@@ -329,18 +329,18 @@ sign :: proc{
|
|
sign_bit_f16 :: proc(x: f16) -> bool {
|
|
sign_bit_f16 :: proc(x: f16) -> bool {
|
|
return (transmute(u16)x) & (1<<15) != 0
|
|
return (transmute(u16)x) & (1<<15) != 0
|
|
}
|
|
}
|
|
-sign_bit_f16le :: proc(x: f16le) -> bool { return #force_inline sign_bit_f16(f16(x)); }
|
|
|
|
-sign_bit_f16be :: proc(x: f16be) -> bool { return #force_inline sign_bit_f16(f16(x)); }
|
|
|
|
|
|
+sign_bit_f16le :: proc(x: f16le) -> bool { return #force_inline sign_bit_f16(f16(x)) }
|
|
|
|
+sign_bit_f16be :: proc(x: f16be) -> bool { return #force_inline sign_bit_f16(f16(x)) }
|
|
sign_bit_f32 :: proc(x: f32) -> bool {
|
|
sign_bit_f32 :: proc(x: f32) -> bool {
|
|
return (transmute(u32)x) & (1<<31) != 0
|
|
return (transmute(u32)x) & (1<<31) != 0
|
|
}
|
|
}
|
|
-sign_bit_f32le :: proc(x: f32le) -> bool { return #force_inline sign_bit_f32(f32(x)); }
|
|
|
|
-sign_bit_f32be :: proc(x: f32be) -> bool { return #force_inline sign_bit_f32(f32(x)); }
|
|
|
|
|
|
+sign_bit_f32le :: proc(x: f32le) -> bool { return #force_inline sign_bit_f32(f32(x)) }
|
|
|
|
+sign_bit_f32be :: proc(x: f32be) -> bool { return #force_inline sign_bit_f32(f32(x)) }
|
|
sign_bit_f64 :: proc(x: f64) -> bool {
|
|
sign_bit_f64 :: proc(x: f64) -> bool {
|
|
return (transmute(u64)x) & (1<<63) != 0
|
|
return (transmute(u64)x) & (1<<63) != 0
|
|
}
|
|
}
|
|
-sign_bit_f64le :: proc(x: f64le) -> bool { return #force_inline sign_bit_f64(f64(x)); }
|
|
|
|
-sign_bit_f64be :: proc(x: f64be) -> bool { return #force_inline sign_bit_f64(f64(x)); }
|
|
|
|
|
|
+sign_bit_f64le :: proc(x: f64le) -> bool { return #force_inline sign_bit_f64(f64(x)) }
|
|
|
|
+sign_bit_f64be :: proc(x: f64be) -> bool { return #force_inline sign_bit_f64(f64(x)) }
|
|
sign_bit :: proc{
|
|
sign_bit :: proc{
|
|
sign_bit_f16, sign_bit_f16le, sign_bit_f16be,
|
|
sign_bit_f16, sign_bit_f16le, sign_bit_f16be,
|
|
sign_bit_f32, sign_bit_f32le, sign_bit_f32be,
|
|
sign_bit_f32, sign_bit_f32le, sign_bit_f32be,
|
|
@@ -354,8 +354,8 @@ copy_sign_f16 :: proc(x, y: f16) -> f16 {
|
|
ix |= iy & 0x8000
|
|
ix |= iy & 0x8000
|
|
return transmute(f16)ix
|
|
return transmute(f16)ix
|
|
}
|
|
}
|
|
-copy_sign_f16le :: proc(x, y: f16le) -> f16le { return #force_inline f16le(copy_sign_f16(f16(x), f16(y))); }
|
|
|
|
-copy_sign_f16be :: proc(x, y: f16be) -> f16be { return #force_inline f16be(copy_sign_f16(f16(x), f16(y))); }
|
|
|
|
|
|
+copy_sign_f16le :: proc(x, y: f16le) -> f16le { return #force_inline f16le(copy_sign_f16(f16(x), f16(y))) }
|
|
|
|
+copy_sign_f16be :: proc(x, y: f16be) -> f16be { return #force_inline f16be(copy_sign_f16(f16(x), f16(y))) }
|
|
copy_sign_f32 :: proc(x, y: f32) -> f32 {
|
|
copy_sign_f32 :: proc(x, y: f32) -> f32 {
|
|
ix := transmute(u32)x
|
|
ix := transmute(u32)x
|
|
iy := transmute(u32)y
|
|
iy := transmute(u32)y
|
|
@@ -363,8 +363,8 @@ copy_sign_f32 :: proc(x, y: f32) -> f32 {
|
|
ix |= iy & 0x8000_0000
|
|
ix |= iy & 0x8000_0000
|
|
return transmute(f32)ix
|
|
return transmute(f32)ix
|
|
}
|
|
}
|
|
-copy_sign_f32le :: proc(x, y: f32le) -> f32le { return #force_inline f32le(copy_sign_f32(f32(x), f32(y))); }
|
|
|
|
-copy_sign_f32be :: proc(x, y: f32be) -> f32be { return #force_inline f32be(copy_sign_f32(f32(x), f32(y))); }
|
|
|
|
|
|
+copy_sign_f32le :: proc(x, y: f32le) -> f32le { return #force_inline f32le(copy_sign_f32(f32(x), f32(y))) }
|
|
|
|
+copy_sign_f32be :: proc(x, y: f32be) -> f32be { return #force_inline f32be(copy_sign_f32(f32(x), f32(y))) }
|
|
copy_sign_f64 :: proc(x, y: f64) -> f64 {
|
|
copy_sign_f64 :: proc(x, y: f64) -> f64 {
|
|
ix := transmute(u64)x
|
|
ix := transmute(u64)x
|
|
iy := transmute(u64)y
|
|
iy := transmute(u64)y
|
|
@@ -372,32 +372,32 @@ copy_sign_f64 :: proc(x, y: f64) -> f64 {
|
|
ix |= iy & 0x8000_0000_0000_0000
|
|
ix |= iy & 0x8000_0000_0000_0000
|
|
return transmute(f64)ix
|
|
return transmute(f64)ix
|
|
}
|
|
}
|
|
-copy_sign_f64le :: proc(x, y: f64le) -> f64le { return #force_inline f64le(copy_sign_f64(f64(x), f64(y))); }
|
|
|
|
-copy_sign_f64be :: proc(x, y: f64be) -> f64be { return #force_inline f64be(copy_sign_f64(f64(x), f64(y))); }
|
|
|
|
|
|
+copy_sign_f64le :: proc(x, y: f64le) -> f64le { return #force_inline f64le(copy_sign_f64(f64(x), f64(y))) }
|
|
|
|
+copy_sign_f64be :: proc(x, y: f64be) -> f64be { return #force_inline f64be(copy_sign_f64(f64(x), f64(y))) }
|
|
copy_sign :: proc{
|
|
copy_sign :: proc{
|
|
copy_sign_f16, copy_sign_f16le, copy_sign_f16be,
|
|
copy_sign_f16, copy_sign_f16le, copy_sign_f16be,
|
|
copy_sign_f32, copy_sign_f32le, copy_sign_f32be,
|
|
copy_sign_f32, copy_sign_f32le, copy_sign_f32be,
|
|
copy_sign_f64, copy_sign_f64le, copy_sign_f64be,
|
|
copy_sign_f64, copy_sign_f64le, copy_sign_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-to_radians_f16 :: proc(degrees: f16) -> f16 { return degrees * RAD_PER_DEG; }
|
|
|
|
-to_radians_f16le :: proc(degrees: f16le) -> f16le { return degrees * RAD_PER_DEG; }
|
|
|
|
-to_radians_f16be :: proc(degrees: f16be) -> f16be { return degrees * RAD_PER_DEG; }
|
|
|
|
-to_radians_f32 :: proc(degrees: f32) -> f32 { return degrees * RAD_PER_DEG; }
|
|
|
|
-to_radians_f32le :: proc(degrees: f32le) -> f32le { return degrees * RAD_PER_DEG; }
|
|
|
|
-to_radians_f32be :: proc(degrees: f32be) -> f32be { return degrees * RAD_PER_DEG; }
|
|
|
|
-to_radians_f64 :: proc(degrees: f64) -> f64 { return degrees * RAD_PER_DEG; }
|
|
|
|
-to_radians_f64le :: proc(degrees: f64le) -> f64le { return degrees * RAD_PER_DEG; }
|
|
|
|
-to_radians_f64be :: proc(degrees: f64be) -> f64be { return degrees * RAD_PER_DEG; }
|
|
|
|
-to_degrees_f16 :: proc(radians: f16) -> f16 { return radians * DEG_PER_RAD; }
|
|
|
|
-to_degrees_f16le :: proc(radians: f16le) -> f16le { return radians * DEG_PER_RAD; }
|
|
|
|
-to_degrees_f16be :: proc(radians: f16be) -> f16be { return radians * DEG_PER_RAD; }
|
|
|
|
-to_degrees_f32 :: proc(radians: f32) -> f32 { return radians * DEG_PER_RAD; }
|
|
|
|
-to_degrees_f32le :: proc(radians: f32le) -> f32le { return radians * DEG_PER_RAD; }
|
|
|
|
-to_degrees_f32be :: proc(radians: f32be) -> f32be { return radians * DEG_PER_RAD; }
|
|
|
|
-to_degrees_f64 :: proc(radians: f64) -> f64 { return radians * DEG_PER_RAD; }
|
|
|
|
-to_degrees_f64le :: proc(radians: f64le) -> f64le { return radians * DEG_PER_RAD; }
|
|
|
|
-to_degrees_f64be :: proc(radians: f64be) -> f64be { return radians * DEG_PER_RAD; }
|
|
|
|
|
|
+to_radians_f16 :: proc(degrees: f16) -> f16 { return degrees * RAD_PER_DEG }
|
|
|
|
+to_radians_f16le :: proc(degrees: f16le) -> f16le { return degrees * RAD_PER_DEG }
|
|
|
|
+to_radians_f16be :: proc(degrees: f16be) -> f16be { return degrees * RAD_PER_DEG }
|
|
|
|
+to_radians_f32 :: proc(degrees: f32) -> f32 { return degrees * RAD_PER_DEG }
|
|
|
|
+to_radians_f32le :: proc(degrees: f32le) -> f32le { return degrees * RAD_PER_DEG }
|
|
|
|
+to_radians_f32be :: proc(degrees: f32be) -> f32be { return degrees * RAD_PER_DEG }
|
|
|
|
+to_radians_f64 :: proc(degrees: f64) -> f64 { return degrees * RAD_PER_DEG }
|
|
|
|
+to_radians_f64le :: proc(degrees: f64le) -> f64le { return degrees * RAD_PER_DEG }
|
|
|
|
+to_radians_f64be :: proc(degrees: f64be) -> f64be { return degrees * RAD_PER_DEG }
|
|
|
|
+to_degrees_f16 :: proc(radians: f16) -> f16 { return radians * DEG_PER_RAD }
|
|
|
|
+to_degrees_f16le :: proc(radians: f16le) -> f16le { return radians * DEG_PER_RAD }
|
|
|
|
+to_degrees_f16be :: proc(radians: f16be) -> f16be { return radians * DEG_PER_RAD }
|
|
|
|
+to_degrees_f32 :: proc(radians: f32) -> f32 { return radians * DEG_PER_RAD }
|
|
|
|
+to_degrees_f32le :: proc(radians: f32le) -> f32le { return radians * DEG_PER_RAD }
|
|
|
|
+to_degrees_f32be :: proc(radians: f32be) -> f32be { return radians * DEG_PER_RAD }
|
|
|
|
+to_degrees_f64 :: proc(radians: f64) -> f64 { return radians * DEG_PER_RAD }
|
|
|
|
+to_degrees_f64le :: proc(radians: f64le) -> f64le { return radians * DEG_PER_RAD }
|
|
|
|
+to_degrees_f64be :: proc(radians: f64be) -> f64be { return radians * DEG_PER_RAD }
|
|
to_radians :: proc{
|
|
to_radians :: proc{
|
|
to_radians_f16, to_radians_f16le, to_radians_f16be,
|
|
to_radians_f16, to_radians_f16le, to_radians_f16be,
|
|
to_radians_f32, to_radians_f32le, to_radians_f32be,
|
|
to_radians_f32, to_radians_f32le, to_radians_f32be,
|
|
@@ -438,8 +438,8 @@ trunc_f16 :: proc(x: f16) -> f16 {
|
|
}
|
|
}
|
|
return trunc_internal(x)
|
|
return trunc_internal(x)
|
|
}
|
|
}
|
|
-trunc_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(trunc_f16(f16(x))); }
|
|
|
|
-trunc_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(trunc_f16(f16(x))); }
|
|
|
|
|
|
+trunc_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(trunc_f16(f16(x))) }
|
|
|
|
+trunc_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(trunc_f16(f16(x))) }
|
|
|
|
|
|
trunc_f32 :: proc(x: f32) -> f32 {
|
|
trunc_f32 :: proc(x: f32) -> f32 {
|
|
trunc_internal :: proc(f: f32) -> f32 {
|
|
trunc_internal :: proc(f: f32) -> f32 {
|
|
@@ -470,8 +470,8 @@ trunc_f32 :: proc(x: f32) -> f32 {
|
|
}
|
|
}
|
|
return trunc_internal(x)
|
|
return trunc_internal(x)
|
|
}
|
|
}
|
|
-trunc_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(trunc_f32(f32(x))); }
|
|
|
|
-trunc_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(trunc_f32(f32(x))); }
|
|
|
|
|
|
+trunc_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(trunc_f32(f32(x))) }
|
|
|
|
+trunc_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(trunc_f32(f32(x))) }
|
|
|
|
|
|
trunc_f64 :: proc(x: f64) -> f64 {
|
|
trunc_f64 :: proc(x: f64) -> f64 {
|
|
trunc_internal :: proc(f: f64) -> f64 {
|
|
trunc_internal :: proc(f: f64) -> f64 {
|
|
@@ -502,8 +502,8 @@ trunc_f64 :: proc(x: f64) -> f64 {
|
|
}
|
|
}
|
|
return trunc_internal(x)
|
|
return trunc_internal(x)
|
|
}
|
|
}
|
|
-trunc_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(trunc_f64(f64(x))); }
|
|
|
|
-trunc_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(trunc_f64(f64(x))); }
|
|
|
|
|
|
+trunc_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(trunc_f64(f64(x))) }
|
|
|
|
+trunc_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(trunc_f64(f64(x))) }
|
|
trunc :: proc{
|
|
trunc :: proc{
|
|
trunc_f16, trunc_f16le, trunc_f16be,
|
|
trunc_f16, trunc_f16le, trunc_f16be,
|
|
trunc_f32, trunc_f32le, trunc_f32be,
|
|
trunc_f32, trunc_f32le, trunc_f32be,
|
|
@@ -545,17 +545,17 @@ round :: proc{
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-ceil_f16 :: proc(x: f16) -> f16 { return -floor(-x); }
|
|
|
|
-ceil_f16le :: proc(x: f16le) -> f16le { return -floor(-x); }
|
|
|
|
-ceil_f16be :: proc(x: f16be) -> f16be { return -floor(-x); }
|
|
|
|
|
|
+ceil_f16 :: proc(x: f16) -> f16 { return -floor(-x) }
|
|
|
|
+ceil_f16le :: proc(x: f16le) -> f16le { return -floor(-x) }
|
|
|
|
+ceil_f16be :: proc(x: f16be) -> f16be { return -floor(-x) }
|
|
|
|
|
|
-ceil_f32 :: proc(x: f32) -> f32 { return -floor(-x); }
|
|
|
|
-ceil_f32le :: proc(x: f32le) -> f32le { return -floor(-x); }
|
|
|
|
-ceil_f32be :: proc(x: f32be) -> f32be { return -floor(-x); }
|
|
|
|
|
|
+ceil_f32 :: proc(x: f32) -> f32 { return -floor(-x) }
|
|
|
|
+ceil_f32le :: proc(x: f32le) -> f32le { return -floor(-x) }
|
|
|
|
+ceil_f32be :: proc(x: f32be) -> f32be { return -floor(-x) }
|
|
|
|
|
|
-ceil_f64 :: proc(x: f64) -> f64 { return -floor(-x); }
|
|
|
|
-ceil_f64le :: proc(x: f64le) -> f64le { return -floor(-x); }
|
|
|
|
-ceil_f64be :: proc(x: f64be) -> f64be { return -floor(-x); }
|
|
|
|
|
|
+ceil_f64 :: proc(x: f64) -> f64 { return -floor(-x) }
|
|
|
|
+ceil_f64le :: proc(x: f64le) -> f64le { return -floor(-x) }
|
|
|
|
+ceil_f64be :: proc(x: f64be) -> f64be { return -floor(-x) }
|
|
|
|
|
|
ceil :: proc{
|
|
ceil :: proc{
|
|
ceil_f16, ceil_f16le, ceil_f16be,
|
|
ceil_f16, ceil_f16le, ceil_f16be,
|
|
@@ -577,8 +577,8 @@ floor_f16 :: proc(x: f16) -> f16 {
|
|
d, _ := modf(x)
|
|
d, _ := modf(x)
|
|
return d
|
|
return d
|
|
}
|
|
}
|
|
-floor_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(floor_f16(f16(x))); }
|
|
|
|
-floor_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(floor_f16(f16(x))); }
|
|
|
|
|
|
+floor_f16le :: proc(x: f16le) -> f16le { return #force_inline f16le(floor_f16(f16(x))) }
|
|
|
|
+floor_f16be :: proc(x: f16be) -> f16be { return #force_inline f16be(floor_f16(f16(x))) }
|
|
floor_f32 :: proc(x: f32) -> f32 {
|
|
floor_f32 :: proc(x: f32) -> f32 {
|
|
if x == 0 || is_nan(x) || is_inf(x) {
|
|
if x == 0 || is_nan(x) || is_inf(x) {
|
|
return x
|
|
return x
|
|
@@ -593,8 +593,8 @@ floor_f32 :: proc(x: f32) -> f32 {
|
|
d, _ := modf(x)
|
|
d, _ := modf(x)
|
|
return d
|
|
return d
|
|
}
|
|
}
|
|
-floor_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(floor_f32(f32(x))); }
|
|
|
|
-floor_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(floor_f32(f32(x))); }
|
|
|
|
|
|
+floor_f32le :: proc(x: f32le) -> f32le { return #force_inline f32le(floor_f32(f32(x))) }
|
|
|
|
+floor_f32be :: proc(x: f32be) -> f32be { return #force_inline f32be(floor_f32(f32(x))) }
|
|
floor_f64 :: proc(x: f64) -> f64 {
|
|
floor_f64 :: proc(x: f64) -> f64 {
|
|
if x == 0 || is_nan(x) || is_inf(x) {
|
|
if x == 0 || is_nan(x) || is_inf(x) {
|
|
return x
|
|
return x
|
|
@@ -609,8 +609,8 @@ floor_f64 :: proc(x: f64) -> f64 {
|
|
d, _ := modf(x)
|
|
d, _ := modf(x)
|
|
return d
|
|
return d
|
|
}
|
|
}
|
|
-floor_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(floor_f64(f64(x))); }
|
|
|
|
-floor_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(floor_f64(f64(x))); }
|
|
|
|
|
|
+floor_f64le :: proc(x: f64le) -> f64le { return #force_inline f64le(floor_f64(f64(x))) }
|
|
|
|
+floor_f64be :: proc(x: f64be) -> f64be { return #force_inline f64be(floor_f64(f64(x))) }
|
|
floor :: proc{
|
|
floor :: proc{
|
|
floor_f16, floor_f16le, floor_f16be,
|
|
floor_f16, floor_f16le, floor_f16be,
|
|
floor_f32, floor_f32le, floor_f32be,
|
|
floor_f32, floor_f32le, floor_f32be,
|
|
@@ -754,8 +754,8 @@ mod_f16 :: proc(x, y: f16) -> (n: f16) {
|
|
}
|
|
}
|
|
return copy_sign(n, x)
|
|
return copy_sign(n, x)
|
|
}
|
|
}
|
|
-mod_f16le :: proc(x, y: f16le) -> (n: f16le) { return #force_inline f16le(mod_f16(f16(x), f16(y))); }
|
|
|
|
-mod_f16be :: proc(x, y: f16be) -> (n: f16be) { return #force_inline f16be(mod_f16(f16(x), f16(y))); }
|
|
|
|
|
|
+mod_f16le :: proc(x, y: f16le) -> (n: f16le) { return #force_inline f16le(mod_f16(f16(x), f16(y))) }
|
|
|
|
+mod_f16be :: proc(x, y: f16be) -> (n: f16be) { return #force_inline f16be(mod_f16(f16(x), f16(y))) }
|
|
mod_f32 :: proc(x, y: f32) -> (n: f32) {
|
|
mod_f32 :: proc(x, y: f32) -> (n: f32) {
|
|
z := abs(y)
|
|
z := abs(y)
|
|
n = remainder(abs(x), z)
|
|
n = remainder(abs(x), z)
|
|
@@ -764,8 +764,8 @@ mod_f32 :: proc(x, y: f32) -> (n: f32) {
|
|
}
|
|
}
|
|
return copy_sign(n, x)
|
|
return copy_sign(n, x)
|
|
}
|
|
}
|
|
-mod_f32le :: proc(x, y: f32le) -> (n: f32le) { return #force_inline f32le(mod_f32(f32(x), f32(y))); }
|
|
|
|
-mod_f32be :: proc(x, y: f32be) -> (n: f32be) { return #force_inline f32be(mod_f32(f32(x), f32(y))); }
|
|
|
|
|
|
+mod_f32le :: proc(x, y: f32le) -> (n: f32le) { return #force_inline f32le(mod_f32(f32(x), f32(y))) }
|
|
|
|
+mod_f32be :: proc(x, y: f32be) -> (n: f32be) { return #force_inline f32be(mod_f32(f32(x), f32(y))) }
|
|
mod_f64 :: proc(x, y: f64) -> (n: f64) {
|
|
mod_f64 :: proc(x, y: f64) -> (n: f64) {
|
|
z := abs(y)
|
|
z := abs(y)
|
|
n = remainder(abs(x), z)
|
|
n = remainder(abs(x), z)
|
|
@@ -774,23 +774,23 @@ mod_f64 :: proc(x, y: f64) -> (n: f64) {
|
|
}
|
|
}
|
|
return copy_sign(n, x)
|
|
return copy_sign(n, x)
|
|
}
|
|
}
|
|
-mod_f64le :: proc(x, y: f64le) -> (n: f64le) { return #force_inline f64le(mod_f64(f64(x), f64(y))); }
|
|
|
|
-mod_f64be :: proc(x, y: f64be) -> (n: f64be) { return #force_inline f64be(mod_f64(f64(x), f64(y))); }
|
|
|
|
|
|
+mod_f64le :: proc(x, y: f64le) -> (n: f64le) { return #force_inline f64le(mod_f64(f64(x), f64(y))) }
|
|
|
|
+mod_f64be :: proc(x, y: f64be) -> (n: f64be) { return #force_inline f64be(mod_f64(f64(x), f64(y))) }
|
|
mod :: proc{
|
|
mod :: proc{
|
|
mod_f16, mod_f16le, mod_f16be,
|
|
mod_f16, mod_f16le, mod_f16be,
|
|
mod_f32, mod_f32le, mod_f32be,
|
|
mod_f32, mod_f32le, mod_f32be,
|
|
mod_f64, mod_f64le, mod_f64be,
|
|
mod_f64, mod_f64le, mod_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-remainder_f16 :: proc(x, y: f16 ) -> f16 { return x - round(x/y) * y; }
|
|
|
|
-remainder_f16le :: proc(x, y: f16le) -> f16le { return x - round(x/y) * y; }
|
|
|
|
-remainder_f16be :: proc(x, y: f16be) -> f16be { return x - round(x/y) * y; }
|
|
|
|
-remainder_f32 :: proc(x, y: f32 ) -> f32 { return x - round(x/y) * y; }
|
|
|
|
-remainder_f32le :: proc(x, y: f32le) -> f32le { return x - round(x/y) * y; }
|
|
|
|
-remainder_f32be :: proc(x, y: f32be) -> f32be { return x - round(x/y) * y; }
|
|
|
|
-remainder_f64 :: proc(x, y: f64 ) -> f64 { return x - round(x/y) * y; }
|
|
|
|
-remainder_f64le :: proc(x, y: f64le) -> f64le { return x - round(x/y) * y; }
|
|
|
|
-remainder_f64be :: proc(x, y: f64be) -> f64be { return x - round(x/y) * y; }
|
|
|
|
|
|
+remainder_f16 :: proc(x, y: f16 ) -> f16 { return x - round(x/y) * y }
|
|
|
|
+remainder_f16le :: proc(x, y: f16le) -> f16le { return x - round(x/y) * y }
|
|
|
|
+remainder_f16be :: proc(x, y: f16be) -> f16be { return x - round(x/y) * y }
|
|
|
|
+remainder_f32 :: proc(x, y: f32 ) -> f32 { return x - round(x/y) * y }
|
|
|
|
+remainder_f32le :: proc(x, y: f32le) -> f32le { return x - round(x/y) * y }
|
|
|
|
+remainder_f32be :: proc(x, y: f32be) -> f32be { return x - round(x/y) * y }
|
|
|
|
+remainder_f64 :: proc(x, y: f64 ) -> f64 { return x - round(x/y) * y }
|
|
|
|
+remainder_f64le :: proc(x, y: f64le) -> f64le { return x - round(x/y) * y }
|
|
|
|
+remainder_f64be :: proc(x, y: f64be) -> f64be { return x - round(x/y) * y }
|
|
remainder :: proc{
|
|
remainder :: proc{
|
|
remainder_f16, remainder_f16le, remainder_f16be,
|
|
remainder_f16, remainder_f16le, remainder_f16be,
|
|
remainder_f32, remainder_f32le, remainder_f32be,
|
|
remainder_f32, remainder_f32le, remainder_f32be,
|
|
@@ -958,8 +958,8 @@ classify_f16 :: proc(x: f16) -> Float_Class {
|
|
}
|
|
}
|
|
return .Normal
|
|
return .Normal
|
|
}
|
|
}
|
|
-classify_f16le :: proc(x: f16le) -> Float_Class { return #force_inline classify_f16(f16(x)); }
|
|
|
|
-classify_f16be :: proc(x: f16be) -> Float_Class { return #force_inline classify_f16(f16(x)); }
|
|
|
|
|
|
+classify_f16le :: proc(x: f16le) -> Float_Class { return #force_inline classify_f16(f16(x)) }
|
|
|
|
+classify_f16be :: proc(x: f16be) -> Float_Class { return #force_inline classify_f16(f16(x)) }
|
|
classify_f32 :: proc(x: f32) -> Float_Class {
|
|
classify_f32 :: proc(x: f32) -> Float_Class {
|
|
switch {
|
|
switch {
|
|
case x == 0:
|
|
case x == 0:
|
|
@@ -984,8 +984,8 @@ classify_f32 :: proc(x: f32) -> Float_Class {
|
|
}
|
|
}
|
|
return .Normal
|
|
return .Normal
|
|
}
|
|
}
|
|
-classify_f32le :: proc(x: f32le) -> Float_Class { return #force_inline classify_f32(f32(x)); }
|
|
|
|
-classify_f32be :: proc(x: f32be) -> Float_Class { return #force_inline classify_f32(f32(x)); }
|
|
|
|
|
|
+classify_f32le :: proc(x: f32le) -> Float_Class { return #force_inline classify_f32(f32(x)) }
|
|
|
|
+classify_f32be :: proc(x: f32be) -> Float_Class { return #force_inline classify_f32(f32(x)) }
|
|
classify_f64 :: proc(x: f64) -> Float_Class {
|
|
classify_f64 :: proc(x: f64) -> Float_Class {
|
|
switch {
|
|
switch {
|
|
case x == 0:
|
|
case x == 0:
|
|
@@ -1009,23 +1009,23 @@ classify_f64 :: proc(x: f64) -> Float_Class {
|
|
}
|
|
}
|
|
return .Normal
|
|
return .Normal
|
|
}
|
|
}
|
|
-classify_f64le :: proc(x: f64le) -> Float_Class { return #force_inline classify_f64(f64(x)); }
|
|
|
|
-classify_f64be :: proc(x: f64be) -> Float_Class { return #force_inline classify_f64(f64(x)); }
|
|
|
|
|
|
+classify_f64le :: proc(x: f64le) -> Float_Class { return #force_inline classify_f64(f64(x)) }
|
|
|
|
+classify_f64be :: proc(x: f64be) -> Float_Class { return #force_inline classify_f64(f64(x)) }
|
|
classify :: proc{
|
|
classify :: proc{
|
|
classify_f16, classify_f16le, classify_f16be,
|
|
classify_f16, classify_f16le, classify_f16be,
|
|
classify_f32, classify_f32le, classify_f32be,
|
|
classify_f32, classify_f32le, classify_f32be,
|
|
classify_f64, classify_f64le, classify_f64be,
|
|
classify_f64, classify_f64le, classify_f64be,
|
|
}
|
|
}
|
|
|
|
|
|
-is_nan_f16 :: proc(x: f16) -> bool { return classify(x) == .NaN; }
|
|
|
|
-is_nan_f16le :: proc(x: f16le) -> bool { return classify(x) == .NaN; }
|
|
|
|
-is_nan_f16be :: proc(x: f16be) -> bool { return classify(x) == .NaN; }
|
|
|
|
-is_nan_f32 :: proc(x: f32) -> bool { return classify(x) == .NaN; }
|
|
|
|
-is_nan_f32le :: proc(x: f32le) -> bool { return classify(x) == .NaN; }
|
|
|
|
-is_nan_f32be :: proc(x: f32be) -> bool { return classify(x) == .NaN; }
|
|
|
|
-is_nan_f64 :: proc(x: f64) -> bool { return classify(x) == .NaN; }
|
|
|
|
-is_nan_f64le :: proc(x: f64le) -> bool { return classify(x) == .NaN; }
|
|
|
|
-is_nan_f64be :: proc(x: f64be) -> bool { return classify(x) == .NaN; }
|
|
|
|
|
|
+is_nan_f16 :: proc(x: f16) -> bool { return classify(x) == .NaN }
|
|
|
|
+is_nan_f16le :: proc(x: f16le) -> bool { return classify(x) == .NaN }
|
|
|
|
+is_nan_f16be :: proc(x: f16be) -> bool { return classify(x) == .NaN }
|
|
|
|
+is_nan_f32 :: proc(x: f32) -> bool { return classify(x) == .NaN }
|
|
|
|
+is_nan_f32le :: proc(x: f32le) -> bool { return classify(x) == .NaN }
|
|
|
|
+is_nan_f32be :: proc(x: f32be) -> bool { return classify(x) == .NaN }
|
|
|
|
+is_nan_f64 :: proc(x: f64) -> bool { return classify(x) == .NaN }
|
|
|
|
+is_nan_f64le :: proc(x: f64le) -> bool { return classify(x) == .NaN }
|
|
|
|
+is_nan_f64be :: proc(x: f64be) -> bool { return classify(x) == .NaN }
|
|
is_nan :: proc{
|
|
is_nan :: proc{
|
|
is_nan_f16, is_nan_f16le, is_nan_f16be,
|
|
is_nan_f16, is_nan_f16le, is_nan_f16be,
|
|
is_nan_f32, is_nan_f32le, is_nan_f32be,
|
|
is_nan_f32, is_nan_f32le, is_nan_f32be,
|