Trait Float

Source
pub trait Float:
    One
    + Zero
    + Clone
    + Infinity
    + FloatOps
    + PartialEq {
    // Required methods
    fn sqrt(self) -> Self;
    fn min(self, rhs: Self) -> Self;
    fn max(self, rhs: Self) -> Self;

    // Provided methods
    fn recip(self) -> Self { ... }
    fn rsqrt(self) -> Self { ... }
    fn mean(self, rhs: Self) -> Self { ... }
}
Expand description

Trait for floating-point numbers.

Required Methods§

Source

fn sqrt(self) -> Self

Returns the square root of a float.

Source

fn min(self, rhs: Self) -> Self

Returns the minimum between two floats.

Source

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

Returns the maximum between two floats.

Provided Methods§

Source

fn recip(self) -> Self

Returns the reciprocal (inverse) of a float.

Source

fn rsqrt(self) -> Self

Returns the reciprocal (inverse) square root of a float.

Source

fn mean(self, rhs: Self) -> Self

Returns the mean of two floats.

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.

Implementations on Foreign Types§

Source§

impl Float for f32

Source§

fn recip(self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn rsqrt(self) -> Self

Source§

fn min(self, rhs: Self) -> Self

Source§

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

Source§

impl Float for f64

Source§

fn recip(self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn rsqrt(self) -> Self

Source§

fn min(self, rhs: Self) -> Self

Source§

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

Implementors§