Skip to content

Commit d5cad7a

Browse files
committed
more float constants: sqrt(5), 1/sqrt(5), ln(3)
rename EGAMMA to GAMMA
1 parent 4056082 commit d5cad7a

File tree

4 files changed

+59
-4
lines changed

4 files changed

+59
-4
lines changed

library/core/src/num/f128.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub mod consts {
3939
/// The Euler-Mascheroni constant (γ)
4040
#[unstable(feature = "f128", issue = "116909")]
4141
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
42-
pub const EGAMMA: f128 = 0.577215664901532860606512090082402431042159335939923598805767_f128;
42+
pub const GAMMA: f128 = 0.577215664901532860606512090082402431042159335939923598805767_f128;
4343

4444
/// π/2
4545
#[unstable(feature = "f128", issue = "116909")]
@@ -107,6 +107,17 @@ pub mod consts {
107107
pub const FRAC_1_SQRT_3: f128 =
108108
0.577350269189625764509148780501957455647601751270126876018602_f128;
109109

110+
/// sqrt(5)
111+
#[unstable(feature = "f128", issue = "116909")]
112+
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
113+
pub const SQRT_5: f128 = 2.23606797749978969640917366873127623544061835961152572427089_f128;
114+
115+
/// 1/sqrt(5)
116+
#[unstable(feature = "f128", issue = "116909")]
117+
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
118+
pub const FRAC_1_SQRT_5: f128 =
119+
0.447213595499957939281834733746255247088123671922305144854179_f128;
120+
110121
/// Euler's number (e)
111122
#[unstable(feature = "f128", issue = "116909")]
112123
pub const E: f128 = 2.71828182845904523536028747135266249775724709369995957496697_f128;
@@ -131,6 +142,11 @@ pub mod consts {
131142
#[unstable(feature = "f128", issue = "116909")]
132143
pub const LN_2: f128 = 0.693147180559945309417232121458176568075500134360255254120680_f128;
133144

145+
/// ln(3)
146+
#[unstable(feature = "f128", issue = "116909")]
147+
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
148+
pub const LN_3: f128 = 1.09861228866810969139524523692252570464749055782274945173469_f128;
149+
134150
/// ln(10)
135151
#[unstable(feature = "f128", issue = "116909")]
136152
pub const LN_10: f128 = 2.30258509299404568401799145468436420760110148862877297603333_f128;

library/core/src/num/f16.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub mod consts {
4141
/// The Euler-Mascheroni constant (γ)
4242
#[unstable(feature = "f16", issue = "116909")]
4343
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
44-
pub const EGAMMA: f16 = 0.577215664901532860606512090082402431_f16;
44+
pub const GAMMA: f16 = 0.577215664901532860606512090082402431_f16;
4545

4646
/// π/2
4747
#[unstable(feature = "f16", issue = "116909")]
@@ -104,6 +104,16 @@ pub mod consts {
104104
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
105105
pub const FRAC_1_SQRT_3: f16 = 0.577350269189625764509148780501957456_f16;
106106

107+
/// sqrt(5)
108+
#[unstable(feature = "f16", issue = "116909")]
109+
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
110+
pub const SQRT_5: f16 = 2.236067977499789696409173668731276235_f16;
111+
112+
/// 1/sqrt(5)
113+
#[unstable(feature = "f16", issue = "116909")]
114+
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
115+
pub const FRAC_1_SQRT_5: f16 = 0.447213595499957939281834733746255247_f16;
116+
107117
/// Euler's number (e)
108118
#[unstable(feature = "f16", issue = "116909")]
109119
pub const E: f16 = 2.71828182845904523536028747135266250_f16;
@@ -128,6 +138,11 @@ pub mod consts {
128138
#[unstable(feature = "f16", issue = "116909")]
129139
pub const LN_2: f16 = 0.693147180559945309417232121458176568_f16;
130140

141+
/// ln(3)
142+
#[unstable(feature = "f16", issue = "116909")]
143+
// Also, #[unstable(feature = "more_float_constants", issue = "103883")]
144+
pub const LN_3: f16 = 1.098612288668109691395245236922525704_f16;
145+
131146
/// ln(10)
132147
#[unstable(feature = "f16", issue = "116909")]
133148
pub const LN_10: f16 = 2.30258509299404568401799145468436421_f16;

library/core/src/num/f32.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ pub mod consts {
296296

297297
/// The Euler-Mascheroni constant (γ)
298298
#[unstable(feature = "more_float_constants", issue = "103883")]
299-
pub const EGAMMA: f32 = 0.577215664901532860606512090082402431_f32;
299+
pub const GAMMA: f32 = 0.577215664901532860606512090082402431_f32;
300300

301301
/// π/2
302302
#[stable(feature = "rust1", since = "1.0.0")]
@@ -355,6 +355,14 @@ pub mod consts {
355355
#[unstable(feature = "more_float_constants", issue = "103883")]
356356
pub const FRAC_1_SQRT_3: f32 = 0.577350269189625764509148780501957456_f32;
357357

358+
/// sqrt(5)
359+
#[unstable(feature = "more_float_constants", issue = "103883")]
360+
pub const SQRT_5: f32 = 2.236067977499789696409173668731276235_f32;
361+
362+
/// 1/sqrt(5)
363+
#[unstable(feature = "more_float_constants", issue = "103883")]
364+
pub const FRAC_1_SQRT_5: f32 = 0.447213595499957939281834733746255247_f32;
365+
358366
/// Euler's number (e)
359367
#[stable(feature = "rust1", since = "1.0.0")]
360368
pub const E: f32 = 2.71828182845904523536028747135266250_f32;
@@ -379,6 +387,10 @@ pub mod consts {
379387
#[stable(feature = "rust1", since = "1.0.0")]
380388
pub const LN_2: f32 = 0.693147180559945309417232121458176568_f32;
381389

390+
/// ln(3)
391+
#[unstable(feature = "more_float_constants", issue = "103883")]
392+
pub const LN_3: f32 = 1.098612288668109691395245236922525704_f32;
393+
382394
/// ln(10)
383395
#[stable(feature = "rust1", since = "1.0.0")]
384396
pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;

library/core/src/num/f64.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ pub mod consts {
296296

297297
/// The Euler-Mascheroni constant (γ)
298298
#[unstable(feature = "more_float_constants", issue = "103883")]
299-
pub const EGAMMA: f64 = 0.577215664901532860606512090082402431_f64;
299+
pub const GAMMA: f64 = 0.577215664901532860606512090082402431_f64;
300300

301301
/// π/2
302302
#[stable(feature = "rust1", since = "1.0.0")]
@@ -355,6 +355,14 @@ pub mod consts {
355355
#[unstable(feature = "more_float_constants", issue = "103883")]
356356
pub const FRAC_1_SQRT_3: f64 = 0.577350269189625764509148780501957456_f64;
357357

358+
/// sqrt(5)
359+
#[unstable(feature = "more_float_constants", issue = "103883")]
360+
pub const SQRT_5: f64 = 2.236067977499789696409173668731276235_f64;
361+
362+
/// 1/sqrt(5)
363+
#[unstable(feature = "more_float_constants", issue = "103883")]
364+
pub const FRAC_1_SQRT_5: f64 = 0.447213595499957939281834733746255247_f64;
365+
358366
/// Euler's number (e)
359367
#[stable(feature = "rust1", since = "1.0.0")]
360368
pub const E: f64 = 2.71828182845904523536028747135266250_f64;
@@ -379,6 +387,10 @@ pub mod consts {
379387
#[stable(feature = "rust1", since = "1.0.0")]
380388
pub const LN_2: f64 = 0.693147180559945309417232121458176568_f64;
381389

390+
/// ln(3)
391+
#[unstable(feature = "more_float_constants", issue = "103883")]
392+
pub const LN_3: f64 = 1.098612288668109691395245236922525704_f64;
393+
382394
/// ln(10)
383395
#[stable(feature = "rust1", since = "1.0.0")]
384396
pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64;

0 commit comments

Comments
 (0)