Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions library/core/src/num/f128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ pub mod consts {
pub const FRAC_1_SQRT_3: f128 =
0.577350269189625764509148780501957455647601751270126876018602_f128;

/// sqrt(5)
#[unstable(feature = "more_float_constants", issue = "146939")]
// Also, #[unstable(feature = "f128", issue = "116909")]
pub const SQRT_5: f128 = 2.23606797749978969640917366873127623544061835961152572427089_f128;

/// 1/sqrt(5)
#[unstable(feature = "more_float_constants", issue = "146939")]
// Also, #[unstable(feature = "f128", issue = "116909")]
pub const FRAC_1_SQRT_5: f128 =
0.447213595499957939281834733746255247088123671922305144854179_f128;
Comment on lines 111 to 120
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For f16 and f128, gate these under more_float_constants and leave the f128 gate in a comment. Bit safer since stabilizing this feature without f16/f128 would still not let you use these, but not the other way around.


/// Euler's number (e)
#[unstable(feature = "f128", issue = "116909")]
pub const E: f128 = 2.71828182845904523536028747135266249775724709369995957496697_f128;
Expand Down
10 changes: 10 additions & 0 deletions library/core/src/num/f16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ pub mod consts {
// Also, #[unstable(feature = "more_float_constants", issue = "146939")]
pub const FRAC_1_SQRT_3: f16 = 0.577350269189625764509148780501957456_f16;

/// sqrt(5)
#[unstable(feature = "more_float_constants", issue = "146939")]
// Also, #[unstable(feature = "f16", issue = "116909")]
pub const SQRT_5: f16 = 2.23606797749978969640917366873127623_f16;

/// 1/sqrt(5)
#[unstable(feature = "more_float_constants", issue = "146939")]
// Also, #[unstable(feature = "f16", issue = "116909")]
pub const FRAC_1_SQRT_5: f16 = 0.44721359549995793928183473374625524_f16;

/// Euler's number (e)
#[unstable(feature = "f16", issue = "116909")]
pub const E: f16 = 2.71828182845904523536028747135266250_f16;
Expand Down
8 changes: 8 additions & 0 deletions library/core/src/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ pub mod consts {
#[unstable(feature = "more_float_constants", issue = "146939")]
pub const FRAC_1_SQRT_3: f32 = 0.577350269189625764509148780501957456_f32;

/// sqrt(5)
#[unstable(feature = "more_float_constants", issue = "146939")]
pub const SQRT_5: f32 = 2.23606797749978969640917366873127623_f32;

/// 1/sqrt(5)
#[unstable(feature = "more_float_constants", issue = "146939")]
pub const FRAC_1_SQRT_5: f32 = 0.44721359549995793928183473374625524_f32;

/// Euler's number (e)
#[stable(feature = "rust1", since = "1.0.0")]
pub const E: f32 = 2.71828182845904523536028747135266250_f32;
Expand Down
8 changes: 8 additions & 0 deletions library/core/src/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ pub mod consts {
#[unstable(feature = "more_float_constants", issue = "146939")]
pub const FRAC_1_SQRT_3: f64 = 0.577350269189625764509148780501957456_f64;

/// sqrt(5)
#[unstable(feature = "more_float_constants", issue = "146939")]
pub const SQRT_5: f64 = 2.23606797749978969640917366873127623_f64;

/// 1/sqrt(5)
#[unstable(feature = "more_float_constants", issue = "146939")]
pub const FRAC_1_SQRT_5: f64 = 0.44721359549995793928183473374625524_f64;

/// Euler's number (e)
#[stable(feature = "rust1", since = "1.0.0")]
pub const E: f64 = 2.71828182845904523536028747135266250_f64;
Expand Down
Loading