pub trait Atan: Sized {
fn atan(self) -> Self;
}
#[cfg(any(feature = "std", feature = "libm"))]
mod float_impls {
use super::Atan;
#[inline]
fn atan_f32(x: f32) -> f32 {
#[cfg(feature = "libm")]
{
libm::atanf(x)
}
#[cfg(not(feature = "libm"))]
{
f32::atan(x)
}
}
#[inline]
fn atan_f64(x: f64) -> f64 {
#[cfg(feature = "libm")]
{
libm::atan(x)
}
#[cfg(not(feature = "libm"))]
{
f64::atan(x)
}
}
macro_rules! impl_atan_for_float {
($ty:ty, $fn:ident) => {
impl Atan for $ty {
fn atan(self) -> Self {
$fn(self)
}
}
};
}
impl_atan_for_float!(f32, atan_f32);
impl_atan_for_float!(f64, atan_f64);
}