Skip to content

Commit a7144b6

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

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
@@ -40,7 +40,7 @@ pub mod consts {
4040
/// The Euler-Mascheroni constant (γ)
4141
#[unstable(feature = "f128", issue = "116909")]
4242
// Also, #[unstable(feature = "more_float_constants", issue = "146939")]
43-
pub const EGAMMA: f128 = 0.577215664901532860606512090082402431042159335939923598805767_f128;
43+
pub const GAMMA: f128 = 0.577215664901532860606512090082402431042159335939923598805767_f128;
4444

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

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

146+
/// ln(3)
147+
#[unstable(feature = "f128", issue = "116909")]
148+
// Also, #[unstable(feature = "more_float_constants", issue = "146939")]
149+
pub const LN_3: f128 = 1.09861228866810969139524523692252570464749055782274945173469_f128;
150+
135151
/// ln(10)
136152
#[unstable(feature = "f128", issue = "116909")]
137153
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
@@ -42,7 +42,7 @@ pub mod consts {
4242
/// The Euler-Mascheroni constant (γ)
4343
#[unstable(feature = "f16", issue = "116909")]
4444
// Also, #[unstable(feature = "more_float_constants", issue = "146939")]
45-
pub const EGAMMA: f16 = 0.577215664901532860606512090082402431_f16;
45+
pub const GAMMA: f16 = 0.577215664901532860606512090082402431_f16;
4646

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

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

142+
/// ln(3)
143+
#[unstable(feature = "f16", issue = "116909")]
144+
// Also, #[unstable(feature = "more_float_constants", issue = "146939")]
145+
pub const LN_3: f16 = 1.098612288668109691395245236922525704_f16;
146+
132147
/// ln(10)
133148
#[unstable(feature = "f16", issue = "116909")]
134149
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
@@ -297,7 +297,7 @@ pub mod consts {
297297

298298
/// The Euler-Mascheroni constant (γ)
299299
#[unstable(feature = "more_float_constants", issue = "146939")]
300-
pub const EGAMMA: f32 = 0.577215664901532860606512090082402431_f32;
300+
pub const GAMMA: f32 = 0.577215664901532860606512090082402431_f32;
301301

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

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

391+
/// ln(3)
392+
#[unstable(feature = "more_float_constants", issue = "146939")]
393+
pub const LN_3: f32 = 1.098612288668109691395245236922525704_f32;
394+
383395
/// ln(10)
384396
#[stable(feature = "rust1", since = "1.0.0")]
385397
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
@@ -297,7 +297,7 @@ pub mod consts {
297297

298298
/// The Euler-Mascheroni constant (γ)
299299
#[unstable(feature = "more_float_constants", issue = "146939")]
300-
pub const EGAMMA: f64 = 0.577215664901532860606512090082402431_f64;
300+
pub const GAMMA: f64 = 0.577215664901532860606512090082402431_f64;
301301

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

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

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

0 commit comments

Comments
 (0)