pub trait FloatConst {
const E: Self;
const FRAC_1_PI: Self;
const FRAC_1_SQRT_2: 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 LN_2: Self;
const LN_10: Self;
const LOG2_10: Self;
const LOG2_E: Self;
const LOG10_2: Self;
const LOG10_E: Self;
const PI: Self;
const SQRT_2: Self;
const TAU: Self;
}
macro_rules! impl_float_const {
($($t:ident )*) => {
$(
impl FloatConst for $t {
const E: Self = std::$t::consts::E;
const FRAC_1_PI: Self = std::$t::consts::FRAC_1_PI;
const FRAC_1_SQRT_2: Self = std::$t::consts::FRAC_1_SQRT_2;
const FRAC_2_PI: Self = std::$t::consts::FRAC_2_PI;
const FRAC_2_SQRT_PI: Self = std::$t::consts::FRAC_2_SQRT_PI;
const FRAC_PI_2: Self = std::$t::consts::FRAC_PI_2;
const FRAC_PI_3: Self = std::$t::consts::FRAC_PI_3;
const FRAC_PI_4: Self = std::$t::consts::FRAC_PI_4;
const FRAC_PI_6: Self = std::$t::consts::FRAC_PI_6;
const FRAC_PI_8: Self = std::$t::consts::FRAC_PI_8;
const LN_2: Self = std::$t::consts::LN_2;
const LN_10: Self = std::$t::consts::LN_10;
const LOG2_10: Self = std::$t::consts::LOG2_10;
const LOG2_E: Self = std::$t::consts::LOG2_E;
const LOG10_2: Self = std::$t::consts::LOG10_2;
const LOG10_E: Self = std::$t::consts::LOG10_E;
const PI: Self = std::$t::consts::PI;
const SQRT_2: Self = std::$t::consts::SQRT_2;
const TAU: Self = std::$t::consts::TAU;
}
)*
};
}
impl_float_const!(f32 f64);