#[cfg(not(feature = "std"))]
pub(crate) trait FloatExt {
fn mul_add(self, a: Self, b: Self) -> Self;
fn sqrt(self) -> Self;
fn floor(self) -> Self;
fn atan2(self, other: Self) -> Self;
}
#[cfg(not(feature = "std"))]
impl FloatExt for f64 {
#[inline]
fn mul_add(self, a: Self, b: Self) -> Self {
libm::fma(self, a, b)
}
#[inline]
fn sqrt(self) -> Self {
libm::sqrt(self)
}
#[inline]
fn floor(self) -> Self {
libm::floor(self)
}
#[inline]
fn atan2(self, other: Self) -> Self {
libm::atan2(self, other)
}
}
#[cfg(not(feature = "std"))]
impl FloatExt for f32 {
#[inline]
fn mul_add(self, a: Self, b: Self) -> Self {
libm::fmaf(self, a, b)
}
#[inline]
fn sqrt(self) -> Self {
libm::sqrtf(self)
}
#[inline]
fn floor(self) -> Self {
libm::floorf(self)
}
#[inline]
fn atan2(self, other: Self) -> Self {
libm::atan2f(self, other)
}
}