Trait comlib_math::Numeric[][src]

pub trait Numeric: Copy + Display + Debug + Add<Output = Self> + Sub<Output = Self> + Mul<Output = Self> + Div<Output = Self> + Rem<Output = Self> + AddAssign + SubAssign + MulAssign + DivAssign + RemAssign + PartialEq + PartialOrd + Default {
    fn zero() -> Self;
fn one() -> Self;
fn from_int(value: i8) -> Self;
fn as_f64(self) -> f64; fn is_zero(self) -> bool { ... }
fn is_one(self) -> bool { ... }
fn as_f32(self) -> f32 { ... } }
Expand description

Trait implemented by numeric types.

Required methods

Returns zero.

Returns one.

Converts the given integer to the type.

This function implements best-effort conversion and may fail in unexpected ways for values unsuitable for the target data type.

Converts the number to f64.

Provided methods

Tests whether value is zero.

Tests whether value is one.

Converts the number to f32.

The default implementation first converts the number into f64 and then casts it to f32.

Implementations on Foreign Types

Implementors