Skip to main content

FloatExt

Trait FloatExt 

Source
pub trait FloatExt: Sized + Sub<Self, Output = Self> {
    // Required methods
    fn is_nearly_zero(&self) -> bool;
    fn is_nearly_zero_within_tolerance(&self, tolerance: f32) -> bool;
}
Expand description

A number of useful methods for floating-point numbers.

Required Methods§

Source

fn is_nearly_zero(&self) -> bool

Whether the number is approximately 0.

Source

fn is_nearly_zero_within_tolerance(&self, tolerance: f32) -> bool

Whether the number is approximately 0, with a given tolerance.

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 FloatExt for f32

Source§

impl FloatExt for f64

Implementors§