Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
use crate::abs_diff;
use crate::soft_f32::SoftF32;
type F = SoftF32;
pub(crate) const fn pow(a: F, b: i32) -> F {
let mut a = a;
let recip = b < 0;
let mut pow = abs_diff(b, 0);
let mut mul = F::ONE;
loop {
if (pow & 1) != 0 {
mul = mul.mul(a);
}
pow >>= 1;
if pow == 0 {
break;
}
a = a.mul(a);
}
if recip {
F::ONE.div(mul)
} else {
mul
}
}
#[cfg(test)]
mod test {
use crate::soft_f32::SoftF32;
#[test]
fn sanity_check() {
assert_eq!(SoftF32(2.0).powi(2).0, 4.0)
}
}