pub trait TrigonometricOps: Sized {
fn hypot(self, other: Self) -> Self;
fn sin(self) -> Self;
fn cos(self) -> Self;
fn tan(self) -> Self;
fn asin(self) -> Self;
fn acos(self) -> Self;
fn atan(self) -> Self;
fn atan2(self, other: Self) -> Self;
fn sin_cos(self) -> (Self, Self);
}
macro_rules! impl_trigonometric {
($($t:ty),*) => {
$(impl TrigonometricOps for $t {
#[inline] fn hypot(self, other: Self) -> Self { self.hypot(other) }
#[inline] fn sin(self) -> Self { self.sin() }
#[inline] fn cos(self) -> Self { self.cos() }
#[inline] fn tan(self) -> Self { self.tan() }
#[inline] fn asin(self) -> Self { self.asin() }
#[inline] fn acos(self) -> Self { self.acos() }
#[inline] fn atan(self) -> Self { self.atan() }
#[inline] fn atan2(self, other: Self) -> Self { self.atan2(other) }
#[inline] fn sin_cos(self) -> (Self, Self) { self.sin_cos() }
})*
};
}
impl_trigonometric!(f32, f64);