macro_rules! decl_fast_transcendentals_via_f64 {
($Type:ident) => {
#[cfg(feature = "std")]
impl<const SCALE: u32> $Type<SCALE> {
#[inline]
#[must_use]
pub fn ln_fast(self) -> Self {
Self::from_f64(self.to_f64().ln())
}
#[inline]
#[must_use]
pub fn log_fast(self, base: Self) -> Self {
Self::from_f64(self.to_f64().log(base.to_f64()))
}
#[inline]
#[must_use]
pub fn log2_fast(self) -> Self {
Self::from_f64(self.to_f64().log2())
}
#[inline]
#[must_use]
pub fn log10_fast(self) -> Self {
Self::from_f64(self.to_f64().log10())
}
#[inline]
#[must_use]
pub fn exp_fast(self) -> Self {
Self::from_f64(self.to_f64().exp())
}
#[inline]
#[must_use]
pub fn exp2_fast(self) -> Self {
Self::from_f64(self.to_f64().exp2())
}
#[inline]
#[must_use]
pub fn sqrt_fast(self) -> Self {
Self::from_f64(self.to_f64().sqrt())
}
#[inline]
#[must_use]
pub fn cbrt_fast(self) -> Self {
Self::from_f64(self.to_f64().cbrt())
}
#[inline]
#[must_use]
pub fn powf_fast(self, exp: Self) -> Self {
Self::from_f64(self.to_f64().powf(exp.to_f64()))
}
#[inline]
#[must_use]
pub fn hypot_fast(self, other: Self) -> Self {
Self::from_f64(self.to_f64().hypot(other.to_f64()))
}
#[inline]
#[must_use]
pub fn sin_fast(self) -> Self {
Self::from_f64(self.to_f64().sin())
}
#[inline]
#[must_use]
pub fn cos_fast(self) -> Self {
Self::from_f64(self.to_f64().cos())
}
#[inline]
#[must_use]
pub fn tan_fast(self) -> Self {
Self::from_f64(self.to_f64().tan())
}
#[inline]
#[must_use]
pub fn asin_fast(self) -> Self {
Self::from_f64(self.to_f64().asin())
}
#[inline]
#[must_use]
pub fn acos_fast(self) -> Self {
Self::from_f64(self.to_f64().acos())
}
#[inline]
#[must_use]
pub fn atan_fast(self) -> Self {
Self::from_f64(self.to_f64().atan())
}
#[inline]
#[must_use]
pub fn atan2_fast(self, other: Self) -> Self {
Self::from_f64(self.to_f64().atan2(other.to_f64()))
}
#[inline]
#[must_use]
pub fn sinh_fast(self) -> Self {
Self::from_f64(self.to_f64().sinh())
}
#[inline]
#[must_use]
pub fn cosh_fast(self) -> Self {
Self::from_f64(self.to_f64().cosh())
}
#[inline]
#[must_use]
pub fn tanh_fast(self) -> Self {
Self::from_f64(self.to_f64().tanh())
}
#[inline]
#[must_use]
pub fn asinh_fast(self) -> Self {
Self::from_f64(self.to_f64().asinh())
}
#[inline]
#[must_use]
pub fn acosh_fast(self) -> Self {
Self::from_f64(self.to_f64().acosh())
}
#[inline]
#[must_use]
pub fn atanh_fast(self) -> Self {
Self::from_f64(self.to_f64().atanh())
}
#[inline]
#[must_use]
pub fn to_degrees_fast(self) -> Self {
Self::from_f64(self.to_f64().to_degrees())
}
#[inline]
#[must_use]
pub fn to_radians_fast(self) -> Self {
Self::from_f64(self.to_f64().to_radians())
}
}
#[cfg(all(feature = "std", any(not(feature = "strict"), feature = "fast")))]
impl<const SCALE: u32> $Type<SCALE> {
#[inline] #[must_use] pub fn ln(self) -> Self { self.ln_fast() }
#[inline] #[must_use] pub fn log(self, base: Self) -> Self { self.log_fast(base) }
#[inline] #[must_use] pub fn log2(self) -> Self { self.log2_fast() }
#[inline] #[must_use] pub fn log10(self) -> Self { self.log10_fast() }
#[inline] #[must_use] pub fn exp(self) -> Self { self.exp_fast() }
#[inline] #[must_use] pub fn exp2(self) -> Self { self.exp2_fast() }
#[inline] #[must_use] pub fn sqrt(self) -> Self { self.sqrt_fast() }
#[inline] #[must_use] pub fn cbrt(self) -> Self { self.cbrt_fast() }
#[inline] #[must_use] pub fn powf(self, exp: Self) -> Self { self.powf_fast(exp) }
#[inline] #[must_use] pub fn hypot(self, other: Self) -> Self { self.hypot_fast(other) }
#[inline] #[must_use] pub fn sin(self) -> Self { self.sin_fast() }
#[inline] #[must_use] pub fn cos(self) -> Self { self.cos_fast() }
#[inline] #[must_use] pub fn tan(self) -> Self { self.tan_fast() }
#[inline] #[must_use] pub fn asin(self) -> Self { self.asin_fast() }
#[inline] #[must_use] pub fn acos(self) -> Self { self.acos_fast() }
#[inline] #[must_use] pub fn atan(self) -> Self { self.atan_fast() }
#[inline] #[must_use] pub fn atan2(self, other: Self) -> Self { self.atan2_fast(other) }
#[inline] #[must_use] pub fn sinh(self) -> Self { self.sinh_fast() }
#[inline] #[must_use] pub fn cosh(self) -> Self { self.cosh_fast() }
#[inline] #[must_use] pub fn tanh(self) -> Self { self.tanh_fast() }
#[inline] #[must_use] pub fn asinh(self) -> Self { self.asinh_fast() }
#[inline] #[must_use] pub fn acosh(self) -> Self { self.acosh_fast() }
#[inline] #[must_use] pub fn atanh(self) -> Self { self.atanh_fast() }
#[inline] #[must_use] pub fn to_degrees(self) -> Self { self.to_degrees_fast() }
#[inline] #[must_use] pub fn to_radians(self) -> Self { self.to_radians_fast() }
}
};
}
pub(crate) use decl_fast_transcendentals_via_f64;