Repository navigation
Closed
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.T-langRelevant to the language teamT-libs-api[DEPRECATED; DO NOT USE]disposition-mergeThis 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.
Milestone
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,f32andf128
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
constsupport for float rounding methods #141521 - Final comment period (FCP)1
- Stabilization PR Stabilize
const_float_round_methods#143604
Unresolved Questions
- Should the rounding methods on
f16andf128be gated behind#[rustc_const_unstable(feature = {"f16", "f128"}, issue = "116909")](from Tracking Issue forf16andf128float types #116909) or#[rustc_const_unstable(feature = "const_float_round_methods", issue = "<this one>")]? The answer is both! Check out this comment: Addconstsupport for float rounding methods #141521 (comment).
Footnotes
Footnotes
Reacted by ⭐️NINIKA⭐️
Reacted by José Luis Cruz
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.T-langRelevant to the language teamT-libs-api[DEPRECATED; DO NOT USE]disposition-mergeThis 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.
Activity
Add const support for float rounding methods
Add const support for float rounding methods
Rollup merge of rust-lang#141521 - ruancomelli:const-float-rounding, …
Rollup merge of rust-lang#141521 - ruancomelli:const-float-rounding, …
Unrolled build for #141521
Add const support for float rounding methods
Rollup merge of #141521 - ruancomelli:const-float-rounding, r=RalfJung
Add const support for float rounding methods
Rollup merge of rust-lang#141521 - ruancomelli:const-float-rounding, …
nxsaken commentedon Jun 30, 2025
@Amanieu seems like this has been implemented, and there are no unresolved questions. Should we start an FCP?
Amanieu commentedon Jun 30, 2025
@rfcbot merge
rfcbot commentedon Jun 30, 2025
Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed.
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!
cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.
11 remaining items
rfcbot commentedon Jul 9, 2025
🔔 This is now entering its final comment period, as per the review above. 🔔
traviscross commentedon Jul 9, 2025
The stabilization PR is now in FCP as well:
const_float_round_methods#143604rfcbot commentedon Jul 19, 2025
The final comment period, with a disposition to merge, as per the review above, is now complete.
As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.
This will be merged soon.
Rollup merge of rust-lang#143604 - nxsaken:const_float_round_methods,…
Rollup merge of rust-lang#143604 - nxsaken:const_float_round_methods,…
Rollup merge of rust-lang#143604 - nxsaken:const_float_round_methods,…
Unrolled build for #143604
Rollup merge of rust-lang#143604 - nxsaken:const_float_round_methods,…
Rollup merge of rust-lang#143604 - nxsaken:const_float_round_methods,…