Skip to main content

Float

Trait Float 

Source
pub trait Float:
    Clone
    + Copy
    + PartialOrd
    + Debug
    + Add<Output = Self>
    + Mul<Output = Self> {
    // Required methods
    fn zero() -> Self;
    fn sqrt(val: Self) -> Self;
    fn from_usize(n: usize) -> Self;
    fn to_f64(self) -> f64;
    fn from_f64(val: f64) -> Self;
    fn max(self, other: Self) -> Self;
}
Expand description

Minimal floating-point trait for generic drift tracking.

This trait provides the operations needed by BoundedDrift on the floating-point type F. Implementations are provided for f32 and f64.

Required Methods§

Source

fn zero() -> Self

Zero value.

Source

fn sqrt(val: Self) -> Self

Square root.

Source

fn from_usize(n: usize) -> Self

Convert from usize.

Source

fn to_f64(self) -> f64

Convert to f64.

Source

fn from_f64(val: f64) -> Self

Convert from f64.

Source

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

Maximum of two values.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Float for f32

Source§

fn zero() -> Self

Source§

fn sqrt(val: Self) -> Self

Source§

fn from_usize(n: usize) -> Self

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(val: f64) -> Self

Source§

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

Source§

impl Float for f64

Source§

fn zero() -> Self

Source§

fn sqrt(val: Self) -> Self

Source§

fn from_usize(n: usize) -> Self

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(val: f64) -> Self

Source§

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

Implementors§