Tracking Issue for `core_float_math`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(core_float_math)]
This is a tracking issue for floating point math operations in core.
Public API
The following API will be made available in core:
impl {f16, f32, f64, f128} {
pub fn floor(self) -> Self;
pub fn ceil(self) -> Self;
pub fn round(self) -> Self;
pub fn round_ties_even(self) -> Self;
pub fn trunc(self) -> Self;
pub fn fract(self) -> Self;
pub fn mul_add(self, a: Self, b: Self) -> Self;
pub fn div_euclid(self, rhs: f128) -> Self;
pub fn rem_euclid(self, rhs: f128) -> Self;
pub fn powi(self, n: i32) -> Self;
pub fn sqrt(self) -> Self;
// Not yet added to f128
pub fn cbrt(self) -> Self;
// Deprecated, but there isn't any reason not to move it
pub fn abs_sub(self, other: Self) -> Self;
}
More will be added in the future. The blocker for others is the quality of our libm implementations (I am working on improving this).
For f32 and f64, it isn't easily possible to have the methods unstable in core but stable in std, so standalone functions are used for the feature gate (e.g. core::f32::sqrt). For stabilization these will be changed to inherent and the duplicates in std removed.
Steps / History
- Background
- Methods moved from
coretostdto avoid Clibmdependency https://github.com/rust-lang/rust/pull/27823 - Discussion https://github.com/rust-lang/rust/issues/50145
- Discussion https://github.com/rust-lang/rfcs/issues/2505
- Trivial methods moved to
corehttps://github.com/rust-lang/rust/pull/131304
- Methods moved from
- Implementation:
- Initial implementation https://github.com/rust-lang/rust/pull/138087
- Functions moved to a module https://github.com/rust-lang/rust/pull/141282
- Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
- [] Not a direct blocker but it would be nice to have a better story about https://github.com/rust-lang/rust/issues/142119
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
Start with the core_float_math feature gate, the listed public API, and the stabilization guide linked in the final comment period. Review the implementation PRs and unresolved issue #142119; done means completing the final comment period and stabilization PR for the tracked API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100