#![doc(
html_favicon_url = "https://raw.githubusercontent.com/olson-sean-k/decorum/master/doc/decorum-favicon.ico"
)]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/olson-sean-k/decorum/master/doc/decorum.svg?sanitize=true"
)]
#![no_std]
#[cfg(feature = "std")]
extern crate std;
use core::num::FpCategory;
use core::ops::Neg;
#[allow(unused_imports)]
use num_traits::{Num, NumCast, Signed};
#[cfg(not(feature = "std"))]
pub(in crate) use num_traits::float::FloatCore as ForeignFloat;
#[cfg(feature = "std")]
pub(in crate) use num_traits::real::Real as ForeignReal;
#[cfg(feature = "std")]
pub(in crate) use num_traits::Float as ForeignFloat;
mod canonical;
pub mod cmp;
mod constraint;
pub mod hash;
mod primitive;
mod proxy;
use crate::cmp::IntrinsicOrd;
use crate::constraint::{FiniteConstraint, NotNanConstraint, UnitConstraint};
pub use crate::canonical::ToCanonicalBits;
pub use crate::primitive::Primitive;
pub use crate::proxy::ConstrainedFloat;
pub type Total<T> = ConstrainedFloat<T, UnitConstraint<T>>;
pub type NotNan<T> = ConstrainedFloat<T, NotNanConstraint<T>>;
pub type N32 = NotNan<f32>;
pub type N64 = NotNan<f64>;
pub type Finite<T> = ConstrainedFloat<T, FiniteConstraint<T>>;
pub type R32 = Finite<f32>;
pub type R64 = Finite<f64>;
pub trait Infinite: Encoding {
const INFINITY: Self;
const NEG_INFINITY: Self;
fn is_infinite(self) -> bool;
fn is_finite(self) -> bool;
}
pub trait Nan: Encoding {
const NAN: Self;
fn is_nan(self) -> bool;
}
pub trait Encoding: Copy {
const MAX: Self;
const MIN: Self;
const MIN_POSITIVE: Self;
const EPSILON: Self;
fn classify(self) -> FpCategory;
fn is_normal(self) -> bool;
fn is_sign_positive(self) -> bool;
fn is_sign_negative(self) -> bool;
fn integer_decode(self) -> (u64, i16, i8);
}
pub trait Real: Copy + Neg<Output = Self> + Num + PartialOrd + Signed {
const E: Self;
const PI: Self;
const FRAC_1_PI: Self;
const FRAC_2_PI: Self;
const FRAC_2_SQRT_PI: Self;
const FRAC_PI_2: Self;
const FRAC_PI_3: Self;
const FRAC_PI_4: Self;
const FRAC_PI_6: Self;
const FRAC_PI_8: Self;
const SQRT_2: Self;
const FRAC_1_SQRT_2: Self;
const LN_2: Self;
const LN_10: Self;
const LOG2_E: Self;
const LOG10_E: Self;
fn floor(self) -> Self;
fn ceil(self) -> Self;
fn round(self) -> Self;
fn trunc(self) -> Self;
fn fract(self) -> Self;
fn recip(self) -> Self;
#[cfg(feature = "std")]
fn mul_add(self, a: Self, b: Self) -> Self;
#[cfg(feature = "std")]
fn powi(self, n: i32) -> Self;
#[cfg(feature = "std")]
fn powf(self, n: Self) -> Self;
#[cfg(feature = "std")]
fn sqrt(self) -> Self;
#[cfg(feature = "std")]
fn cbrt(self) -> Self;
#[cfg(feature = "std")]
fn exp(self) -> Self;
#[cfg(feature = "std")]
fn exp2(self) -> Self;
#[cfg(feature = "std")]
fn exp_m1(self) -> Self;
#[cfg(feature = "std")]
fn log(self, base: Self) -> Self;
#[cfg(feature = "std")]
fn ln(self) -> Self;
#[cfg(feature = "std")]
fn log2(self) -> Self;
#[cfg(feature = "std")]
fn log10(self) -> Self;
#[cfg(feature = "std")]
fn ln_1p(self) -> Self;
#[cfg(feature = "std")]
fn hypot(self, other: Self) -> Self;
#[cfg(feature = "std")]
fn sin(self) -> Self;
#[cfg(feature = "std")]
fn cos(self) -> Self;
#[cfg(feature = "std")]
fn tan(self) -> Self;
#[cfg(feature = "std")]
fn asin(self) -> Self;
#[cfg(feature = "std")]
fn acos(self) -> Self;
#[cfg(feature = "std")]
fn atan(self) -> Self;
#[cfg(feature = "std")]
fn atan2(self, other: Self) -> Self;
#[cfg(feature = "std")]
fn sin_cos(self) -> (Self, Self);
#[cfg(feature = "std")]
fn sinh(self) -> Self;
#[cfg(feature = "std")]
fn cosh(self) -> Self;
#[cfg(feature = "std")]
fn tanh(self) -> Self;
#[cfg(feature = "std")]
fn asinh(self) -> Self;
#[cfg(feature = "std")]
fn acosh(self) -> Self;
#[cfg(feature = "std")]
fn atanh(self) -> Self;
}
pub trait Float: Encoding + Infinite + IntrinsicOrd + Nan + Real {}
impl<T> Float for T where T: Encoding + Infinite + IntrinsicOrd + Nan + Real {}