Skip to main content

ExactNumber

Trait ExactNumber 

Source
pub trait ExactNumber:
    Clone
    + Ord
    + Add<Output = Self>
    + Mul<Output = Self> {
    // Required methods
    fn zero() -> Self;
    fn one() -> Self;
    fn abs_diff(&self, other: &Self) -> Self;
}
Expand description

A number type closed under exact + and *, with a zero, a one and a distance, for comparisons that WideMul cannot express: sums of products, products of three or more costs.

Implemented by BigUint and BigInt (exact) and, behind float, by NonNegF64 (rounded like f64).

Required Methods§

Source

fn zero() -> Self

Zero.

Source

fn one() -> Self

One.

Source

fn abs_diff(&self, other: &Self) -> Self

|self - other|.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ExactNumber for BigInt

Source§

impl ExactNumber for BigUint

Source§

impl ExactNumber for NonNegF64

Available on crate feature float only.