MathBackend

Trait MathBackend 

Source
pub trait MathBackend<T> {
Show 15 methods // Required methods fn sqrt(&self, x: T) -> T; fn abs(&self, x: T) -> T; fn min(&self, a: T, b: T) -> T; fn max(&self, a: T, b: T) -> T; fn floor(&self, x: T) -> T; fn ceil(&self, x: T) -> T; fn pow(&self, x: T, y: T) -> T; fn ln(&self, x: T) -> T; fn log10(&self, x: T) -> T; fn sin(&self, x: T) -> T; fn cos(&self, x: T) -> T; fn tan(&self, x: T) -> T; fn to_radians(&self, degrees: T) -> T; fn to_degrees(&self, radians: T) -> T; fn atan2(&self, y: T, x: T) -> T;
}
Expand description

Backend trait that provides math operations for a specific numeric type

Required Methods§

Source

fn sqrt(&self, x: T) -> T

Calculate the square root

Source

fn abs(&self, x: T) -> T

Calculate the absolute value

Source

fn min(&self, a: T, b: T) -> T

Return the minimum of two values

Source

fn max(&self, a: T, b: T) -> T

Return the maximum of two values

Source

fn floor(&self, x: T) -> T

Calculate the floor

Source

fn ceil(&self, x: T) -> T

Calculate the ceiling

Source

fn pow(&self, x: T, y: T) -> T

Raise to a power

Source

fn ln(&self, x: T) -> T

Natural logarithm

Source

fn log10(&self, x: T) -> T

Base-10 logarithm

Source

fn sin(&self, x: T) -> T

Sine function

Source

fn cos(&self, x: T) -> T

Cosine function

Source

fn tan(&self, x: T) -> T

Tangent function

Source

fn to_radians(&self, degrees: T) -> T

Convert degrees to radians

Source

fn to_degrees(&self, radians: T) -> T

Convert radians to degrees

Source

fn atan2(&self, y: T, x: T) -> T

Calculate atan2(y, x) - the angle from the positive x-axis to the point (x, y)

Implementors§

Source§

impl MathBackend<f32> for FloatingPointBackend

Available on crate feature floating-point only.
Source§

impl MathBackend<i32> for IntegerBackend

Available on crate feature integer-math only.