-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Tracking Issue for #![feature(const_float_round_methods)]
#141555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
S-tracking-unimplemented
Status: The feature has not been implemented.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Comments
ruancomelli
added a commit
to ruancomelli/rust
that referenced
this issue
May 29, 2025
Add const support for the float rounding methods floor, ceil, trunc, fract, round and round_ties_even. This works by moving the calculation logic from src/tools/miri/src/intrinsics/mod.rs into compiler/rustc_const_eval/src/interpret/intrinsics.rs. All relevant method definitions were adjusted to include the `const` keyword for all supported float types: f16, f32, f64 and f128. The constness is hidden behind the feature gate feature(const_float_round_methods) which is tracked in rust-lang#141555 This commit is a squash of the following commits: - test: add tests that we expect to pass when float rounding becomes const - feat: make float rounding methods `const` - fix: replace `rustc_allow_const_fn_unstable(core_intrinsics)` attribute with `#[rustc_const_unstable(feature = "f128", issue = "116909")]` in `library/core/src/num/f128.rs` - revert: undo update to `library/stdarch` - refactor: replace multiple `float_<mode>_intrinsic` rounding methods with a single, parametrized one - fix: add `#[cfg(not(bootstrap))]` to new const method tests - test: add extra sign tests to check `+0.0` and `-0.0` - revert: undo accidental changes to `round` docs - fix: gate `const` float round method behind `const_float_round_methods` - fix: remove unnecessary `#![feature(const_float_methods)]` - fix: remove unnecessary `#![feature(const_float_methods)]` [2] - revert: undo changes to `tests/ui/consts/const-eval/float_methods.rs` - fix: adjust after rebase - test: fix float tests - test: add tests for `fract` - chore: add commented-out `const_float_round_methods` feature gates to `f16` and `f128` - fix: adjust NaN when rounding floats - chore: add FIXME comment for de-duplicating float tests - test: remove unnecessary test file `tests/ui/consts/const-eval/float_methods.rs` - test: fix tests after upstream simplification of how float tests are run
ruancomelli
added a commit
to ruancomelli/rust
that referenced
this issue
May 31, 2025
Add const support for the float rounding methods floor, ceil, trunc, fract, round and round_ties_even. This works by moving the calculation logic from src/tools/miri/src/intrinsics/mod.rs into compiler/rustc_const_eval/src/interpret/intrinsics.rs. All relevant method definitions were adjusted to include the `const` keyword for all supported float types: f16, f32, f64 and f128. The constness is hidden behind the feature gate feature(const_float_round_methods) which is tracked in rust-lang#141555 This commit is a squash of the following commits: - test: add tests that we expect to pass when float rounding becomes const - feat: make float rounding methods `const` - fix: replace `rustc_allow_const_fn_unstable(core_intrinsics)` attribute with `#[rustc_const_unstable(feature = "f128", issue = "116909")]` in `library/core/src/num/f128.rs` - revert: undo update to `library/stdarch` - refactor: replace multiple `float_<mode>_intrinsic` rounding methods with a single, parametrized one - fix: add `#[cfg(not(bootstrap))]` to new const method tests - test: add extra sign tests to check `+0.0` and `-0.0` - revert: undo accidental changes to `round` docs - fix: gate `const` float round method behind `const_float_round_methods` - fix: remove unnecessary `#![feature(const_float_methods)]` - fix: remove unnecessary `#![feature(const_float_methods)]` [2] - revert: undo changes to `tests/ui/consts/const-eval/float_methods.rs` - fix: adjust after rebase - test: fix float tests - test: add tests for `fract` - chore: add commented-out `const_float_round_methods` feature gates to `f16` and `f128` - fix: adjust NaN when rounding floats - chore: add FIXME comment for de-duplicating float tests - test: remove unnecessary test file `tests/ui/consts/const-eval/float_methods.rs` - test: fix tests after upstream simplification of how float tests are run
jhpratt
added a commit
to jhpratt/rust
that referenced
this issue
May 31, 2025
…r=RalfJung Add `const` support for float rounding methods # Add `const` support for float rounding methods This PR makes the following float rounding methods `const`: - `f64::{floor, ceil, trunc, round, round_ties_even}` - and the corresponding methods for `f16`, `f32` and `f128` Tracking issue: rust-lang#141555 ## Procedure I followed rust-lang@c09ed3e as closely as I could in making float methods `const`, and also received great guidance from https://internals.rust-lang.org/t/const-rounding-methods-in-float-types/22957/3?u=ruancomelli. ## Note This is my first code contribution to the Rust project, so please let me know if I missed anything - I'd be more than happy to revise and learn more. Thank you for taking the time to review it!
jhpratt
added a commit
to jhpratt/rust
that referenced
this issue
May 31, 2025
…r=RalfJung Add `const` support for float rounding methods # Add `const` support for float rounding methods This PR makes the following float rounding methods `const`: - `f64::{floor, ceil, trunc, round, round_ties_even}` - and the corresponding methods for `f16`, `f32` and `f128` Tracking issue: rust-lang#141555 ## Procedure I followed rust-lang@c09ed3e as closely as I could in making float methods `const`, and also received great guidance from https://internals.rust-lang.org/t/const-rounding-methods-in-float-types/22957/3?u=ruancomelli. ## Note This is my first code contribution to the Rust project, so please let me know if I missed anything - I'd be more than happy to revise and learn more. Thank you for taking the time to review it!
rust-timer
added a commit
that referenced
this issue
Jun 1, 2025
Rollup merge of #141521 - ruancomelli:const-float-rounding, r=RalfJung Add `const` support for float rounding methods # Add `const` support for float rounding methods This PR makes the following float rounding methods `const`: - `f64::{floor, ceil, trunc, round, round_ties_even}` - and the corresponding methods for `f16`, `f32` and `f128` Tracking issue: #141555 ## Procedure I followed c09ed3e as closely as I could in making float methods `const`, and also received great guidance from https://internals.rust-lang.org/t/const-rounding-methods-in-float-types/22957/3?u=ruancomelli. ## Note This is my first code contribution to the Rust project, so please let me know if I missed anything - I'd be more than happy to revise and learn more. Thank you for taking the time to review it!
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this issue
Jun 1, 2025
Add const support for the float rounding methods floor, ceil, trunc, fract, round and round_ties_even. This works by moving the calculation logic from src/tools/miri/src/intrinsics/mod.rs into compiler/rustc_const_eval/src/interpret/intrinsics.rs. All relevant method definitions were adjusted to include the `const` keyword for all supported float types: f16, f32, f64 and f128. The constness is hidden behind the feature gate feature(const_float_round_methods) which is tracked in rust-lang/rust#141555 This commit is a squash of the following commits: - test: add tests that we expect to pass when float rounding becomes const - feat: make float rounding methods `const` - fix: replace `rustc_allow_const_fn_unstable(core_intrinsics)` attribute with `#[rustc_const_unstable(feature = "f128", issue = "116909")]` in `library/core/src/num/f128.rs` - revert: undo update to `library/stdarch` - refactor: replace multiple `float_<mode>_intrinsic` rounding methods with a single, parametrized one - fix: add `#[cfg(not(bootstrap))]` to new const method tests - test: add extra sign tests to check `+0.0` and `-0.0` - revert: undo accidental changes to `round` docs - fix: gate `const` float round method behind `const_float_round_methods` - fix: remove unnecessary `#![feature(const_float_methods)]` - fix: remove unnecessary `#![feature(const_float_methods)]` [2] - revert: undo changes to `tests/ui/consts/const-eval/float_methods.rs` - fix: adjust after rebase - test: fix float tests - test: add tests for `fract` - chore: add commented-out `const_float_round_methods` feature gates to `f16` and `f128` - fix: adjust NaN when rounding floats - chore: add FIXME comment for de-duplicating float tests - test: remove unnecessary test file `tests/ui/consts/const-eval/float_methods.rs` - test: fix tests after upstream simplification of how float tests are run
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this issue
Jun 1, 2025
Add `const` support for float rounding methods # Add `const` support for float rounding methods This PR makes the following float rounding methods `const`: - `f64::{floor, ceil, trunc, round, round_ties_even}` - and the corresponding methods for `f16`, `f32` and `f128` Tracking issue: rust-lang/rust#141555 ## Procedure I followed rust-lang/rust@c09ed3e as closely as I could in making float methods `const`, and also received great guidance from https://internals.rust-lang.org/t/const-rounding-methods-in-float-types/22957/3?u=ruancomelli. ## Note This is my first code contribution to the Rust project, so please let me know if I missed anything - I'd be more than happy to revise and learn more. Thank you for taking the time to review it!
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this issue
Jun 3, 2025
Add const support for the float rounding methods floor, ceil, trunc, fract, round and round_ties_even. This works by moving the calculation logic from src/tools/miri/src/intrinsics/mod.rs into compiler/rustc_const_eval/src/interpret/intrinsics.rs. All relevant method definitions were adjusted to include the `const` keyword for all supported float types: f16, f32, f64 and f128. The constness is hidden behind the feature gate feature(const_float_round_methods) which is tracked in rust-lang#141555 This commit is a squash of the following commits: - test: add tests that we expect to pass when float rounding becomes const - feat: make float rounding methods `const` - fix: replace `rustc_allow_const_fn_unstable(core_intrinsics)` attribute with `#[rustc_const_unstable(feature = "f128", issue = "116909")]` in `library/core/src/num/f128.rs` - revert: undo update to `library/stdarch` - refactor: replace multiple `float_<mode>_intrinsic` rounding methods with a single, parametrized one - fix: add `#[cfg(not(bootstrap))]` to new const method tests - test: add extra sign tests to check `+0.0` and `-0.0` - revert: undo accidental changes to `round` docs - fix: gate `const` float round method behind `const_float_round_methods` - fix: remove unnecessary `#![feature(const_float_methods)]` - fix: remove unnecessary `#![feature(const_float_methods)]` [2] - revert: undo changes to `tests/ui/consts/const-eval/float_methods.rs` - fix: adjust after rebase - test: fix float tests - test: add tests for `fract` - chore: add commented-out `const_float_round_methods` feature gates to `f16` and `f128` - fix: adjust NaN when rounding floats - chore: add FIXME comment for de-duplicating float tests - test: remove unnecessary test file `tests/ui/consts/const-eval/float_methods.rs` - test: fix tests after upstream simplification of how float tests are run
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this issue
Jun 3, 2025
…r=RalfJung Add `const` support for float rounding methods # Add `const` support for float rounding methods This PR makes the following float rounding methods `const`: - `f64::{floor, ceil, trunc, round, round_ties_even}` - and the corresponding methods for `f16`, `f32` and `f128` Tracking issue: rust-lang#141555 ## Procedure I followed rust-lang@c09ed3e as closely as I could in making float methods `const`, and also received great guidance from https://internals.rust-lang.org/t/const-rounding-methods-in-float-types/22957/3?u=ruancomelli. ## Note This is my first code contribution to the Rust project, so please let me know if I missed anything - I'd be more than happy to revise and learn more. Thank you for taking the time to review it!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
S-tracking-unimplemented
Status: The feature has not been implemented.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
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}
f16
,f32
andf128
This extends the work done in #130843
Public API
Steps / History
const
support for float rounding methods #141521Unresolved Questions
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
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: