#[inline(always)]
fn atan2(&self, other: f32) -> f32 { atan2(*self, other) }
+
+ /// Simultaneously computes the sine and cosine of the number
+ #[inline(always)]
+ fn sin_cos(&self) -> (f32, f32) {
+ (self.sin(), self.cos())
+ }
}
impl Exponential for f32 {
#[inline(always)]
fn atan2(&self, other: f64) -> f64 { atan2(*self, other) }
+
+ /// Simultaneously computes the sine and cosine of the number
+ #[inline(always)]
+ fn sin_cos(&self) -> (f64, f64) {
+ (self.sin(), self.cos())
+ }
}
impl Exponential for f64 {
fn atan2(&self, other: float) -> float {
(*self as f64).atan2(other as f64) as float
}
+
+ /// Simultaneously computes the sine and cosine of the number
+ #[inline(always)]
+ fn sin_cos(&self) -> (float, float) {
+ match (*self as f64).sin_cos() {
+ (s, c) => (s as float, c as float)
+ }
+ }
}
impl Exponential for float {
fn acos(&self) -> Self;
fn atan(&self) -> Self;
fn atan2(&self, other: Self) -> Self;
+ fn sin_cos(&self) -> (Self, Self);
}
pub trait Exponential {