use core::num::*;
#[allow(clippy::declare_interior_mutable_const)]
pub trait Zero {
const ZERO: Self;
}
#[allow(clippy::declare_interior_mutable_const)]
pub trait One {
const ONE: Self;
}
#[allow(clippy::declare_interior_mutable_const)]
pub trait Two {
const TWO: Self;
}
#[allow(clippy::declare_interior_mutable_const)]
pub trait NegativeOne {
const NEGATIVE_ONE: Self;
}
#[allow(clippy::declare_interior_mutable_const)]
pub trait OneHalf {
const ONE_HALF: Self;
}
#[allow(clippy::declare_interior_mutable_const)]
pub trait NegativeZero {
const NEGATIVE_ZERO: Self;
}
#[allow(clippy::declare_interior_mutable_const)]
pub trait Infinity {
const INFINITY: Self;
}
#[allow(clippy::declare_interior_mutable_const)]
pub trait NegativeInfinity {
const NEGATIVE_INFINITY: Self;
}
#[allow(clippy::declare_interior_mutable_const)]
pub trait NaN {
const NAN: Self;
}
pub trait ProuhetThueMorseConstant {
const PROUHET_THUE_MORSE_CONSTANT: Self;
}
pub trait PrimeConstant {
const PRIME_CONSTANT: Self;
}
pub trait Ln2 {
const LN_2: Self;
}
pub trait Log2E {
const LOG_2_E: Self;
}
pub trait Sqrt2 {
const SQRT_2: Self;
}
pub trait Sqrt3 {
const SQRT_3: Self;
}
pub trait Sqrt2Over2 {
const SQRT_2_OVER_2: Self;
}
pub trait Sqrt3Over3 {
const SQRT_3_OVER_3: Self;
}
pub trait Phi {
const PHI: Self;
}
pub trait Pi {
const PI: Self;
}
pub trait Tau {
const TAU: Self;
}
pub trait PiOver2 {
const PI_OVER_2: Self;
}
pub trait PiOver3 {
const PI_OVER_3: Self;
}
pub trait PiOver4 {
const PI_OVER_4: Self;
}
pub trait PiOver6 {
const PI_OVER_6: Self;
}
pub trait PiOver8 {
const PI_OVER_8: Self;
}
pub trait OneOverPi {
const ONE_OVER_PI: Self;
}
pub trait SqrtPi {
const SQRT_PI: Self;
}
pub trait OneOverSqrtPi {
const ONE_OVER_SQRT_PI: Self;
}
pub trait OneOverSqrtTau {
const ONE_OVER_SQRT_TAU: Self;
}
pub trait TwoOverPi {
const TWO_OVER_PI: Self;
}
pub trait TwoOverSqrtPi {
const TWO_OVER_SQRT_PI: Self;
}
pub trait GaussConstant {
const GAUSS_CONSTANT: Self;
}
pub trait LemniscateConstant {
const LEMNISCATE_CONSTANT: Self;
}
macro_rules! impl_non_zero {
($($t:ident),+) => {
$(
impl One for $t {
const ONE: Self = match Self::new(1) {
Some(v) => v,
None => unreachable!() };
}
impl Two for $t {
const TWO: Self = match Self::new(2) {
Some(v) => v,
None => unreachable!() };
}
)+
};
($($u:ident && $i:ident),+) => {
$(
impl_non_zero!($u, $i);
impl NegativeOne for $i {
const NEGATIVE_ONE: Self = match Self::new(-1) {
Some(v) => v,
None => unreachable!() };
}
)+
}
}
impl_non_zero!(
NonZeroUsize && NonZeroIsize,
NonZeroU128 && NonZeroI128,
NonZeroU64 && NonZeroI64,
NonZeroU32 && NonZeroI32,
NonZeroU16 && NonZeroI16,
NonZeroU8 && NonZeroI8
);