Feature gate: `#![feature(float_algebraic)]` This is a tracking issue for exposing `core::intrinsics::f*_algebraic` in stable Rust, including in const. ### Public API ```rust // core::num::f16 impl f16 { pub const fn algebraic_add(self, rhs: f16) -> f16; pub const fn algebraic_sub(self, rhs: f16) -> f16; pub const fn algebraic_mul(self, rhs: f16) -> f16; pub const fn algebraic_div(self, rhs: f16) -> f16; pub const fn algebraic_rem(self, rhs: f16) -> f16; } ``` ```rust // core::num::f32 impl f32 { pub const fn algebraic_add(self, rhs: f32) -> f32; pub const fn algebraic_sub(self, rhs: f32) -> f32; pub const fn algebraic_mul(self, rhs: f32) -> f32; pub const fn algebraic_div(self, rhs: f32) -> f32; pub const fn algebraic_rem(self, rhs: f32) -> f32; } ``` ```rust // core::num::f64 impl f64 { pub const fn algebraic_add(self, rhs: f64) -> f64; pub const fn algebraic_sub(self, rhs: f64) -> f64; pub const fn algebraic_mul(self, rhs: f64) -> f64; pub const fn algebraic_div(self, rhs: f64) -> f64; pub const fn algebraic_rem(self, rhs: f64) -> f64; } ``` ```rust // core::num::f128 impl f128 { pub const fn algebraic_add(self, rhs: f128) -> f128; pub const fn algebraic_sub(self, rhs: f128) -> f128; pub const fn algebraic_mul(self, rhs: f128) -> f128; pub const fn algebraic_div(self, rhs: f128) -> f128; pub const fn algebraic_rem(self, rhs: f128) -> f128; } ``` ### Steps / History - [x] ACP: https://github.com/rust-lang/libs-team/issues/532 - [ ] Implementation: - [X] https://github.com/rust-lang/rust/pull/120718 - [ ] https://github.com/rust-lang/rust/pull/136457 - [ ] Final comment period (FCP)[^1] - [ ] Stabilization PR ### Unresolved Questions - How does this interact (if at all) with the optional-fused-multiply-add intrinsics added in https://github.com/rust-lang/rust/pull/124874? Do we even still need those? - Naming: "algebraic" is not very descriptive of what this does since the operations themselves are algebraic. ### References * https://github.com/rust-lang/rust/issues/21690 * https://github.com/rust-lang/libs-team/issues/532 * https://github.com/rust-lang/rust/pull/136457 * https://github.com/calder/dot-bench * https://www.felixcloutier.com/x86/vfmadd132ps:vfmadd213ps:vfmadd231ps cc @rust-lang/lang @rust-lang/libs-api [^1]: https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html