MathOps

Trait MathOps 

Source
pub trait MathOps<T>:
    Copy
    + Clone
    + Debug {
    // Required methods
    fn sqrt(self) -> T;
    fn abs(self) -> T;
    fn min(self, other: T) -> T;
    fn max(self, other: T) -> T;
    fn floor(self) -> T;
    fn ceil(self) -> T;
    fn pow(self, exp: T) -> T;
    fn ln(self) -> T;
    fn log10(self) -> T;
}
Expand description

Core mathematical operations that all numeric types should support

Required Methods§

Source

fn sqrt(self) -> T

Calculate the square root

Source

fn abs(self) -> T

Calculate the absolute value

Source

fn min(self, other: T) -> T

Return the minimum of two values

Source

fn max(self, other: T) -> T

Return the maximum of two values

Source

fn floor(self) -> T

Calculate the floor (largest integer less than or equal to the value)

Source

fn ceil(self) -> T

Calculate the ceiling (smallest integer greater than or equal to the value)

Source

fn pow(self, exp: T) -> T

Raise to a power

Source

fn ln(self) -> T

Natural logarithm

Source

fn log10(self) -> T

Base-10 logarithm

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§