Tracking Issue for `float_exact_integer_constants`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(float_exact_integer_constants)]
This is a tracking issue for integer constants that represent the range of consecutive values that can be losslessly round-tripped to and from the corresponding floating point type. Additionally, integers within this range will convert to a floating point value that no other integer will convert to.
Public API
These constants are defined as ±(2mantissa_digits-1).
impl fN {
pub const MAX_EXACT_INTEGER: iN = (1 << Self::MANTISSA_DIGITS) - 1;
pub const MIN_EXACT_INTEGER: iN = -MAX_EXACT_INTEGER;
}
Steps / History
- ACP: https://github.com/rust-lang/libs-team/issues/713
- Implementation: https://github.com/rust-lang/rust/pull/152512
- Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
- Naming: If a better name comes up, it can be changed.
MAX_EXACT_INTEGERwas determined to be the best compromise of suggested names. https://github.com/rust-lang/libs-team/issues/713#issuecomment-3880122239:
Based on the options we've seen, we feel like
MAX_EXACT_INTEGERis a good balance between clarity and brevity. It does still have the property that one could interpret it as allowing one integer larger because that integer's truncated low bit would be 0, but we felt like any name trying to capture that property (and make it clear that the correct value is one less than the appropriate power of two) would be sufficiently verbose as to be less clear.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the linked implementation PR #152512 and the ACP in libs-team issue #713 first. Then follow the stabilization process in the referenced Feature Lifecycle guide; this issue is done when the final comment period and stabilization PR are complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100