pub trait Algebraic: Sized {
type Output;
// Required methods
fn algebraic_add(self, rhs: Self) -> Self::Output;
fn algebraic_sub(self, rhs: Self) -> Self::Output;
fn algebraic_mul(self, rhs: Self) -> Self::Output;
fn algebraic_div(self, rhs: Self) -> Self::Output;
fn algebraic_rem(self, rhs: Self) -> Self::Output;
}Expand description
Arithmetic with an “algebraic” license: the compiler may reassociate, use reciprocal shortcuts, or contract into fused operations.
std’s algebraic_* methods (unstable float_algebraic) allow any
result reachable by real-number-algebra rewrites. The plain IEEE
operation is one such result, so the primitive impls here simply perform
it — a conforming implementation that loses only the optimization
license until std’s intrinsics stabilize and the impls can delegate.
Required Associated Types§
Required Methods§
Sourcefn algebraic_add(self, rhs: Self) -> Self::Output
fn algebraic_add(self, rhs: Self) -> Self::Output
Addition with algebraic rewrite license.
Sourcefn algebraic_sub(self, rhs: Self) -> Self::Output
fn algebraic_sub(self, rhs: Self) -> Self::Output
Subtraction with algebraic rewrite license.
Sourcefn algebraic_mul(self, rhs: Self) -> Self::Output
fn algebraic_mul(self, rhs: Self) -> Self::Output
Multiplication with algebraic rewrite license.
Sourcefn algebraic_div(self, rhs: Self) -> Self::Output
fn algebraic_div(self, rhs: Self) -> Self::Output
Division with algebraic rewrite license.
Sourcefn algebraic_rem(self, rhs: Self) -> Self::Output
fn algebraic_rem(self, rhs: Self) -> Self::Output
Remainder with algebraic rewrite license.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".