Trait Float

Source
pub trait Float:
    Sized
    + Float
    + Lapack
    + ScalarOperand {
    // Required methods
    fn half() -> Self;
    fn total_cmp(&self, other: &Self) -> Ordering;

    // Provided method
    fn sign(self) -> Self { ... }
}

Required Methods§

Source

fn half() -> Self

Source

fn total_cmp(&self, other: &Self) -> Ordering

total_cmp is not implemented in num_traits, so implement it here.

Provided Methods§

Source

fn sign(self) -> Self

A more conventional sign function, because the built-in signum treats signed zeros as positive and negative: https://github.com/rust-lang/rust/issues/57543

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 half() -> Self

Source§

fn total_cmp(&self, other: &Self) -> Ordering

Source§

impl Float for f64

Source§

fn half() -> Self

Source§

fn total_cmp(&self, other: &Self) -> Ordering

Implementors§