Skip to content

Tracking Issue (take 2) for more_float_constants #146939

@tgross35

Description

@tgross35

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.)

Unresolved Questions

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-floating-pointArea: Floating point numbers and arithmeticC-tracking-issueCategory: 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.disposition-mergeThis 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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions