use super::num_traits::*;
impl Num for f64 {
type Element = f64;
type Bool = bool;
#[inline]
fn lanes() -> usize {
1
}
#[inline]
fn splat(val: Self::Element) -> Self {
val
}
#[inline]
fn extract(&self, _i: usize) -> Self::Element {
*self
}
#[inline]
unsafe fn extract_unchecked(&self, _i: usize) -> Self::Element {
*self
}
#[inline]
fn replace(&mut self, _i: usize, val: Self::Element) {
*self = val
}
#[inline]
unsafe fn replace_unchecked(&mut self, _i: usize, val: Self::Element) {
*self = val
}
#[inline]
fn select(self, cond: Self::Bool, other: Self) -> Self {
if cond {
self
} else {
other
}
}
}
#[cfg(any(
feature = "libm_force",
all(feature = "libm_fallback", not(feature = "std"))
))]
impl Signed for f64 {
#[inline]
fn absf(self) -> Self {
libm::fabs(self)
}
#[inline]
fn signumf(self) -> Self {
if self.is_nan() {
Self::NAN
} else {
libm::copysign(1.0_f64, self)
}
}
}
#[cfg(any(
feature = "libm_force",
all(feature = "libm_fallback", not(feature = "std"))
))]
impl Float for f64 {
#[inline]
fn asinf(self) -> Self {
libm::asin(self)
}
#[inline]
fn acosf(self) -> Self {
libm::acos(self)
}
#[inline]
fn atanf(self) -> Self {
libm::atan(self)
}
#[inline]
fn atan2f(self, x: Self) -> Self {
libm::atan2(self, x)
}
#[inline]
fn ceilf(self) -> Self {
libm::ceil(self)
}
#[inline]
fn copysignf(self, sign: Self) -> Self {
libm::copysign(self, sign)
}
#[inline]
fn expf(self) -> Self {
libm::exp(self)
}
#[inline]
fn floorf(self) -> Self {
libm::floor(self)
}
#[inline]
fn is_finite(self) -> Self::Bool {
f64::is_finite(self)
}
#[inline]
fn is_nan(self) -> Self::Bool {
f64::is_nan(self)
}
#[inline]
fn mul_addf(self, b: Self, c: Self) -> Self {
libm::fma(self, b, c)
}
#[inline]
fn powif(self, n: i32) -> Self {
libm::pow(self, n as f64)
}
#[inline]
fn powff(self, n: Self) -> Self {
libm::pow(self, n)
}
#[inline]
fn recip(self) -> Self {
self.recip()
}
#[inline]
fn roundf(self) -> Self {
libm::round(self)
}
#[inline]
fn sqrtf(self) -> Self {
libm::sqrt(self)
}
#[inline]
fn sinf(self) -> Self {
libm::sin(self)
}
#[inline]
fn cosf(self) -> Self {
libm::cos(self)
}
#[inline]
fn sin_cosf(self) -> (Self, Self) {
libm::sincos(self)
}
#[inline]
fn tanf(self) -> Self {
libm::tan(self)
}
#[inline]
fn minf(self, other: Self) -> Self {
libm::fmin(self, other)
}
#[inline]
fn maxf(self, other: Self) -> Self {
libm::fmax(self, other)
}
}
#[cfg(all(feature = "std", not(feature = "libm_force")))]
impl Float for f64 {
#[inline]
fn asinf(self) -> Self {
f64::asin(self)
}
#[inline]
fn acosf(self) -> Self {
f64::acos(self)
}
#[inline]
fn atanf(self) -> Self {
f64::atan(self)
}
#[inline]
fn atan2f(self, x: Self) -> Self {
f64::atan2(self, x)
}
#[inline]
fn ceilf(self) -> Self {
f64::ceil(self)
}
#[inline]
fn copysignf(self, sign: Self) -> Self {
f64::copysign(self, sign)
}
#[inline]
fn expf(self) -> Self {
f64::exp(self)
}
#[inline]
fn floorf(self) -> Self {
f64::floor(self)
}
#[inline]
fn is_finite(self) -> Self::Bool {
f64::is_finite(self)
}
#[inline]
fn is_nan(self) -> Self::Bool {
f64::is_nan(self)
}
#[inline]
fn mul_addf(self, b: Self, c: Self) -> Self {
f64::mul_add(self, b, c)
}
#[inline]
fn powif(self, n: i32) -> Self {
f64::powi(self, n)
}
#[inline]
fn powff(self, n: Self) -> Self {
f64::powf(self, n)
}
#[inline]
fn recip(self) -> Self {
f64::recip(self)
}
#[inline]
fn roundf(self) -> Self {
f64::round(self)
}
#[inline]
fn sqrtf(self) -> Self {
f64::sqrt(self)
}
#[inline]
fn sinf(self) -> Self {
f64::sin(self)
}
#[inline]
fn cosf(self) -> Self {
f64::cos(self)
}
#[inline]
fn sin_cosf(self) -> (Self, Self) {
f64::sin_cos(self)
}
#[inline]
fn tanf(self) -> Self {
f64::tan(self)
}
#[inline]
fn minf(self, other: Self) -> Self {
f64::min(self, other)
}
#[inline]
fn maxf(self, other: Self) -> Self {
f64::max(self, other)
}
}
#[cfg(all(feature = "std", not(feature = "libm_force")))]
impl Signed for f64 {
#[inline]
fn absf(self) -> Self {
f64::abs(self)
}
#[inline]
fn signumf(self) -> Self {
f64::signum(self)
}
}