Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0444ab8

Browse files
committedMay 29, 2024
Add FRAC_1_SQRT_2PI constant to f16/f32/f64/f128
1 parent 65de37a commit 0444ab8

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed
 

‎core/src/num/f128.rs

+6
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ pub mod consts {
6868
pub const FRAC_1_SQRT_PI: f128 =
6969
0.564189583547756286948079451560772585844050629328998856844086_f128;
7070

71+
/// 1/sqrt(2π)
72+
#[unstable(feature = "f128", issue = "116909")]
73+
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
74+
pub const FRAC_1_SQRT_2PI: f128 =
75+
0.398942280401432677939946059934381868475858631164934657665926_f128;
76+
7177
/// 2/π
7278
#[unstable(feature = "f128", issue = "116909")]
7379
pub const FRAC_2_PI: f128 = 0.636619772367581343075535053490057448137838582961825794990669_f128;

‎core/src/num/f16.rs

+5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ pub mod consts {
6767
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
6868
pub const FRAC_1_SQRT_PI: f16 = 0.564189583547756286948079451560772586_f16;
6969

70+
/// 1/sqrt(2π)
71+
#[unstable(feature = "f16", issue = "116909")]
72+
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
73+
pub const FRAC_1_SQRT_2PI: f16 = 0.398942280401432677939946059934381868_f16;
74+
7075
/// 2/π
7176
#[unstable(feature = "f16", issue = "116909")]
7277
pub const FRAC_2_PI: f16 = 0.636619772367581343075535053490057448_f16;

‎core/src/num/f32.rs

+4
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ pub mod consts {
327327
#[unstable(feature = "more_float_constants", issue = "103883")]
328328
pub const FRAC_1_SQRT_PI: f32 = 0.564189583547756286948079451560772586_f32;
329329

330+
/// 1/sqrt(2π)
331+
#[unstable(feature = "more_float_constants", issue = "103883")]
332+
pub const FRAC_1_SQRT_2PI: f32 = 0.398942280401432677939946059934381868_f32;
333+
330334
/// 2/π
331335
#[stable(feature = "rust1", since = "1.0.0")]
332336
pub const FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;

‎core/src/num/f64.rs

+4
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ pub mod consts {
327327
#[unstable(feature = "more_float_constants", issue = "103883")]
328328
pub const FRAC_1_SQRT_PI: f64 = 0.564189583547756286948079451560772586_f64;
329329

330+
/// 1/sqrt(2π)
331+
#[unstable(feature = "more_float_constants", issue = "103883")]
332+
pub const FRAC_1_SQRT_2PI: f64 = 0.398942280401432677939946059934381868_f64;
333+
330334
/// 2/π
331335
#[stable(feature = "rust1", since = "1.0.0")]
332336
pub const FRAC_2_PI: f64 = 0.636619772367581343075535053490057448_f64;

0 commit comments

Comments
 (0)
Failed to load comments.