#[cfg(not(feature = "std"))]
pub trait FloatExt: Sized {
fn sqrt(self) -> Self;
fn sin(self) -> Self;
fn cos(self) -> Self;
fn atan2(self, other: Self) -> Self;
fn floor(self) -> Self;
fn log2(self) -> Self;
fn round(self) -> Self;
}
#[cfg(not(feature = "std"))]
impl FloatExt for f32 {
#[inline]
fn sqrt(self) -> Self {
libm::sqrtf(self)
}
#[inline]
fn sin(self) -> Self {
libm::sinf(self)
}
#[inline]
fn cos(self) -> Self {
libm::cosf(self)
}
#[inline]
fn atan2(self, other: Self) -> Self {
libm::atan2f(self, other)
}
#[inline]
fn floor(self) -> Self {
libm::floorf(self)
}
#[inline]
fn log2(self) -> Self {
libm::log2f(self)
}
#[inline]
fn round(self) -> Self {
libm::roundf(self)
}
}
#[cfg(not(feature = "std"))]
impl FloatExt for f64 {
#[inline]
fn sqrt(self) -> Self {
libm::sqrt(self)
}
#[inline]
fn sin(self) -> Self {
libm::sin(self)
}
#[inline]
fn cos(self) -> Self {
libm::cos(self)
}
#[inline]
fn atan2(self, other: Self) -> Self {
libm::atan2(self, other)
}
#[inline]
fn floor(self) -> Self {
libm::floor(self)
}
#[inline]
fn log2(self) -> Self {
libm::log2(self)
}
#[inline]
fn round(self) -> Self {
libm::round(self)
}
}