macro_rules! decl_decimal_consts {
(wide $Type:ident, $Storage:ty) => {
impl<const SCALE: u32> $crate::consts::DecimalConsts for $Type<SCALE> {
#[inline]
fn pi() -> Self {
Self(<$Storage>::from_i128($crate::consts::pi_at_target::<SCALE>()))
}
#[inline]
fn tau() -> Self {
Self(<$Storage>::from_i128($crate::consts::tau_at_target::<SCALE>()))
}
#[inline]
fn half_pi() -> Self {
Self(<$Storage>::from_i128($crate::consts::half_pi_at_target::<SCALE>()))
}
#[inline]
fn quarter_pi() -> Self {
Self(<$Storage>::from_i128($crate::consts::quarter_pi_at_target::<SCALE>()))
}
#[inline]
fn golden() -> Self {
Self(<$Storage>::from_i128($crate::consts::golden_at_target::<SCALE>()))
}
#[inline]
fn e() -> Self {
Self(<$Storage>::from_i128($crate::consts::e_at_target::<SCALE>()))
}
}
};
($Type:ident, $Storage:ty) => {
impl<const SCALE: u32> $crate::consts::DecimalConsts for $Type<SCALE> {
#[inline]
fn pi() -> Self {
let bits = $crate::consts::pi_at_target::<SCALE>();
Self(bits as $Storage)
}
#[inline]
fn tau() -> Self {
let bits = $crate::consts::tau_at_target::<SCALE>();
Self(bits as $Storage)
}
#[inline]
fn half_pi() -> Self {
let bits = $crate::consts::half_pi_at_target::<SCALE>();
Self(bits as $Storage)
}
#[inline]
fn quarter_pi() -> Self {
let bits = $crate::consts::quarter_pi_at_target::<SCALE>();
Self(bits as $Storage)
}
#[inline]
fn golden() -> Self {
let bits = $crate::consts::golden_at_target::<SCALE>();
Self(bits as $Storage)
}
#[inline]
fn e() -> Self {
let bits = $crate::consts::e_at_target::<SCALE>();
Self(bits as $Storage)
}
}
};
}
pub(crate) use decl_decimal_consts;