-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-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 RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-langRelevant to the language teamRelevant to the language teamT-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.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.to-announceAnnounce this issue on triage meetingAnnounce this issue on triage meeting
Description
Feature gate: #![feature(const_float_round_methods)]
This is a tracking issue for making const
some methods of floating point types:
f64::{floor, ceil, trunc, fract, round, round_ties_even}
- and the corresponding methods for
f16
,f32
andf128
This extends the work done in #130843
Public API
// in `core`
impl <float> {
// ...
pub const fn floor(self) -> Self;
pub const fn ceil(self) -> Self;
pub const fn trunc(self) -> Self;
pub const fn fract(self) -> Self;
pub const fn round(self) -> Self;
pub const fn round_ties_even(self) -> Self;
// ...
}
Steps / History
- Opened a discussion topic on the internals forum: Const rounding methods in float types
- Since all the required machinery was already implemented in the Miri, the implementation was straightforward.
- Implementation: Add
const
support for float rounding methods #141521 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Should the rounding methods on
f16
andf128
be gated behind#[rustc_const_unstable(feature = {"f16", "f128"}, issue = "116909")]
(from Tracking Issue forf16
andf128
float types #116909) or#[rustc_const_unstable(feature = "const_float_round_methods", issue = "<this one>")]
? The answer is both! Check out this comment: Addconst
support for float rounding methods #141521 (comment).
Footnotes
Footnotes
joseluis
Metadata
Metadata
Assignees
Labels
C-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 RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-langRelevant to the language teamRelevant to the language teamT-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.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.to-announceAnnounce this issue on triage meetingAnnounce this issue on triage meeting