Skip to content

Commit

Permalink
Merge pull request #35 from burrbull/constants
Browse files Browse the repository at this point in the history
constants
  • Loading branch information
burrbull committed Aug 11, 2022
2 parents 8d622ab + c980478 commit c09a2c1
Show file tree
Hide file tree
Showing 14 changed files with 1,354 additions and 1,217 deletions.
30 changes: 30 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,3 +534,33 @@ where
)
}
}

pub trait Constants {
const PI: Self;
const FRAC_1_PI: Self;
const FRAC_2_PI: Self;
const FRAC_PI_2: Self;
const FRAC_PI_4: Self;
const NAN: Self;
const INFINITY: Self;
const NEG_INFINITY: Self;
const ZERO: Self;
const NEG_ZERO: Self;
const ONE: Self;
const HALF: Self;
const L10_U: Self;
const L10_L: Self;
const L2_U: Self;
const L2_L: Self;
const R_LN2: Self;
const LOG10_2: Self;
}

macro_rules! cons {
($($name:ident: $ty:ident = $val:expr;)*) => {
$(
const $name: $ty<N> = $ty::from_array([$val; N]);
)*
};
}
pub(crate) use cons;
Loading

0 comments on commit c09a2c1

Please sign in to comment.