-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
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 #103883 but we lost the ability to edit the top post.
Public API
// in core::{f16, f32, f64, f128}::consts
/// The golden ratio (φ)
pub const PHI: f64 = 1.618033988749894848204586834365638118_f64;
/// The Euler-Mascheroni constant (γ)
pub const EGAMMA: f64 = 0.577215664901532860606512090082402431_f64;
/// 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;
Steps / History
(Remember to update the S-tracking-*
label when checking boxes.)
- ACP: ACP: Add a constant for the golden ratio (phi) to the floating point types libs-team#119
- ACP for
FRAC_1_SQRT_2PI
AddFRAC_1_SQRT_2PI
constant libs-team#383 - Implementation: Add additional float constants #103836
- Add
FRAC_1_SQRT_2PI
AddFRAC_1_SQRT_2PI
constant to f16/f32/f64/f128 #125253 - Add constants for
f16
andf128
Add constants for f16 and f128 #123850 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Naming of the Euler-Mascheroni constant (gamma).
-
FRAC_1_SQRT_2PI
orFRAC_1_SQRT_TAU
to match the existingTAU
- Any additional constants?
- How do we decide whether or not a constant makes the cutoff?
Footnotes
bjoernager, joseluis and ebkalderonbjoernager
Metadata
Metadata
Assignees
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.