1 2 3 4 5 6 7 8 9 10 11 12 13 14
pub(crate) trait FloatPolyfill { fn sqrt(self) -> Self; fn powi(self, n: i32) -> Self; } impl FloatPolyfill for f64 { fn sqrt(self) -> Self { libm::sqrt(self) } fn powi(self, n: i32) -> Self { libm::pow(self, n as f64) } }