#![cfg(feature = "std")]
mod test;
use multitype::FloatingPoint;
pub unsafe trait StdFloatingPoint: FloatingPoint {
#[must_use]
fn acos(self) -> Self;
#[must_use]
fn acosh(self) -> Self;
#[must_use]
fn asin(self) -> Self;
#[must_use]
fn asinh(self) -> Self;
#[must_use]
fn atan(self) -> Self;
#[must_use]
fn atan2(self, rhs: Self) -> Self;
#[must_use]
fn atanh(self) -> Self;
#[must_use]
fn cbrt(self) -> Self;
#[must_use]
fn ceil(self) -> Self;
#[must_use]
fn cos(self) -> Self;
#[must_use]
fn cosh(self) -> Self;
#[must_use]
fn div_euclid(self, rhs: Self) -> Self;
#[must_use]
fn exp_m1(self) -> Self;
#[must_use]
fn exp(self) -> Self;
#[must_use]
fn exp2(self) -> Self;
#[must_use]
fn floor(self) -> Self;
#[must_use]
fn fract(self) -> Self;
#[must_use]
fn hypot(self, rhs: Self) -> Self;
#[must_use]
fn ln(self) -> Self;
#[must_use]
fn ln_1p(self) -> Self;
#[must_use]
fn log(self, rhs: Self) -> Self;
#[must_use]
fn log10(self) -> Self;
#[must_use]
fn log2(self) -> Self;
#[must_use]
fn mul_add(self, mul: Self, add: Self) -> Self;
#[must_use]
fn powf(self, rhs: Self) -> Self;
#[must_use]
fn powi(self, rhs: i32) -> Self;
#[must_use]
fn rem_euclid(self, rhs: Self) -> Self;
#[must_use]
fn round_ties_even(self) -> Self;
#[must_use]
fn round(self) -> Self;
#[must_use]
fn sin(self) -> Self;
#[must_use]
fn sin_cos(self) -> (Self, Self);
#[must_use]
fn sinh(self) -> Self;
#[must_use]
fn sqrt(self) -> Self;
#[must_use]
fn tan(self) -> Self;
#[must_use]
fn tanh(self) -> Self;
#[must_use]
fn trunc(self) -> Self;
}
macro_rules! impl_std_floating_point {
{
$(
$(#[$attr:meta])?
$Ty:ty
),*$(,)?
} => {$(
$(#[$attr])?
unsafe impl ::multitype::StdFloatingPoint for $Ty {
#[inline(always)]
fn acos(self) -> Self {
self.acos()
}
#[inline(always)]
fn acosh(self) -> Self {
self.acosh()
}
#[inline(always)]
fn asin(self) -> Self {
self.asin()
}
#[inline(always)]
fn asinh(self) -> Self {
self.asinh()
}
#[inline(always)]
fn atan(self) -> Self {
self.atan()
}
#[inline(always)]
fn atan2(self, rhs: Self) -> Self {
self.atan2(rhs)
}
#[inline(always)]
fn atanh(self) -> Self {
self.atanh()
}
#[inline(always)]
fn cbrt(self) -> Self {
self.cbrt()
}
#[inline(always)]
fn ceil(self) -> Self {
self.ceil()
}
#[inline(always)]
fn cos(self) -> Self {
self.cos()
}
#[inline(always)]
fn cosh(self) -> Self {
self.cosh()
}
#[inline(always)]
fn div_euclid(self, rhs: Self) -> Self {
self.div_euclid(rhs)
}
#[inline(always)]
fn exp_m1(self) -> Self {
self.exp_m1()
}
#[inline(always)]
fn exp(self) -> Self {
self.exp()
}
#[inline(always)]
fn exp2(self) -> Self {
self.exp2()
}
#[inline(always)]
fn floor(self) -> Self {
self.floor()
}
#[inline(always)]
fn fract(self) -> Self {
self.fract()
}
#[inline(always)]
fn hypot(self, rhs: Self) -> Self {
self.hypot(rhs)
}
#[inline(always)]
fn ln(self) -> Self {
self.ln()
}
#[inline(always)]
fn ln_1p(self) -> Self {
self.ln_1p()
}
#[inline(always)]
fn log(self, rhs: Self) -> Self {
self.log(rhs)
}
#[inline(always)]
fn log10(self) -> Self {
self.log10()
}
#[inline(always)]
fn log2(self) -> Self {
self.log2()
}
#[inline(always)]
fn mul_add(self, mul: Self, add: Self) -> Self {
self.mul_add(mul, add)
}
#[inline(always)]
fn powf(self, rhs: Self) -> Self {
self.powf(rhs)
}
#[inline(always)]
fn powi(self, rhs: i32) -> Self {
self.powi(rhs)
}
#[inline(always)]
fn rem_euclid(self, rhs: Self) -> Self {
self.rem_euclid(rhs)
}
#[inline(always)]
fn round_ties_even(self) -> Self {
self.round_ties_even()
}
#[inline(always)]
fn round(self) -> Self {
self.round()
}
#[inline(always)]
fn sin(self) -> Self {
self.sin()
}
#[inline(always)]
fn sin_cos(self) -> (Self, Self) {
self.sin_cos()
}
#[inline(always)]
fn sinh(self) -> Self {
self.sinh()
}
#[inline(always)]
fn sqrt(self) -> Self {
self.sqrt()
}
#[inline(always)]
fn tan(self) -> Self {
self.tan()
}
#[inline(always)]
fn tanh(self) -> Self {
self.tanh()
}
#[inline(always)]
fn trunc(self) -> Self {
self.trunc()
}
}
)*}
}
impl_std_floating_point! {
f32,
f64,
#[cfg(feature = "f128")]
f128,
#[cfg(feature = "f16")]
f16,
}