Tracking Issue (take 2) for `more_float_constants`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(more_float_constants)]
This is a tracking issue for additional constants in the {f16, f32, f64, f128}::consts modules. Most of these match C++, with the exception of 1/sqrt(2π) https://en.cppreference.com/w/cpp/numeric/constants.html.
The original tracking issue was https://github.com/rust-lang/rust/issues/103883 but we lost the ability to edit the top post.
Public API
// in core::{f16, f32, f64, f128}::consts
/// 1/sqrt(π)
pub const FRAC_1_SQRT_PI: f64 = 0.564189583547756286948079451560772586_f64;
/// 1/sqrt(2π)
pub const FRAC_1_SQRT_2PI: f64 = 0.398942280401432677939946059934381868_f64;
/// sqrt(3)
pub const SQRT_3: f64 = 1.732050807568877293527446341505872367_f64;
/// 1/sqrt(3)
pub const FRAC_1_SQRT_3: f64 = 0.577350269189625764509148780501957456_f64;
/* Already stabilized as euler_gamma_golden_ratio */
/// The golden ratio (φ)
pub const GOLDEN_RATIO: f64 = 1.618033988749894848204586834365638118_f64;
/// The Euler-Mascheroni constant (γ)
pub const EULER_GAMMA: f64 = 0.577215664901532860606512090082402431_f64;
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
- ACP: https://github.com/rust-lang/libs-team/issues/119
- ACP for
FRAC_1_SQRT_2PIhttps://github.com/rust-lang/libs-team/issues/383 - Implementation: https://github.com/rust-lang/rust/pull/103836
- Add
FRAC_1_SQRT_2PIhttps://github.com/rust-lang/rust/pull/125253 - Add constants for
f16andf128https://github.com/rust-lang/rust/pull/123850 - Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
- Naming of the Euler-Mascheroni constant (gamma).
-
FRAC_1_SQRT_2PIorFRAC_1_SQRT_TAUto match the existingTAU - Any additional constants?
- How do we decide whether or not a constant makes the cutoff?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the core::{f16, f32, f64, f128}::consts API and the linked implementation and constant-addition pull requests. Review the unresolved questions about naming, additional constants, and the cutoff, then follow the stabilization process; done requires completing the final comment period and stabilization PR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100