pub trait Acos: Sized {
fn acos(self) -> Self;
}
#[cfg(any(feature = "std", feature = "libm"))]
mod float_impls {
use super::Acos;
#[inline]
fn acos_f32(x: f32) -> f32 {
#[cfg(feature = "libm")]
{
libm::acosf(x)
}
#[cfg(not(feature = "libm"))]
{
f32::acos(x)
}
}
#[inline]
fn acos_f64(x: f64) -> f64 {
#[cfg(feature = "libm")]
{
libm::acos(x)
}
#[cfg(not(feature = "libm"))]
{
f64::acos(x)
}
}
macro_rules! impl_acos_for_float {
($ty:ty, $fn:ident) => {
impl Acos for $ty {
fn acos(self) -> Self {
$fn(self)
}
}
};
}
impl_acos_for_float!(f32, acos_f32);
impl_acos_for_float!(f64, acos_f64);
}