Skip to content

Commit

Permalink
Add FRAC_1_SQRT_2PI constant to f16/f32/f64/f128
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsided committed May 29, 2024
1 parent 685a80f commit eb72938
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/core/src/num/f128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ pub mod consts {
pub const FRAC_1_SQRT_PI: f128 =
0.564189583547756286948079451560772585844050629328998856844086_f128;

/// 1/sqrt(2π)
#[unstable(feature = "f128", issue = "116909")]
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
pub const FRAC_1_SQRT_2PI: f128 =
0.398942280401432677939946059934381868475858631164934657665926_f128;

/// 2/π
#[unstable(feature = "f128", issue = "116909")]
pub const FRAC_2_PI: f128 = 0.636619772367581343075535053490057448137838582961825794990669_f128;
Expand Down
5 changes: 5 additions & 0 deletions library/core/src/num/f16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ pub mod consts {
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
pub const FRAC_1_SQRT_PI: f16 = 0.564189583547756286948079451560772586_f16;

/// 1/sqrt(2π)
#[unstable(feature = "f16", issue = "116909")]
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
pub const FRAC_1_SQRT_2PI: f16 = 0.398942280401432677939946059934381868_f16;

/// 2/π
#[unstable(feature = "f16", issue = "116909")]
pub const FRAC_2_PI: f16 = 0.636619772367581343075535053490057448_f16;
Expand Down
4 changes: 4 additions & 0 deletions library/core/src/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ pub mod consts {
#[unstable(feature = "more_float_constants", issue = "103883")]
pub const FRAC_1_SQRT_PI: f32 = 0.564189583547756286948079451560772586_f32;

/// 1/sqrt(2π)
#[unstable(feature = "more_float_constants", issue = "103883")]
pub const FRAC_1_SQRT_2PI: f32 = 0.398942280401432677939946059934381868_f32;

/// 2/π
#[stable(feature = "rust1", since = "1.0.0")]
pub const FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;
Expand Down
4 changes: 4 additions & 0 deletions library/core/src/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ pub mod consts {
#[unstable(feature = "more_float_constants", issue = "103883")]
pub const FRAC_1_SQRT_PI: f64 = 0.564189583547756286948079451560772586_f64;

/// 1/sqrt(2π)
#[unstable(feature = "more_float_constants", issue = "103883")]
pub const FRAC_1_SQRT_2PI: f64 = 0.398942280401432677939946059934381868_f64;

/// 2/π
#[stable(feature = "rust1", since = "1.0.0")]
pub const FRAC_2_PI: f64 = 0.636619772367581343075535053490057448_f64;
Expand Down

0 comments on commit eb72938

Please sign in to comment.