Real

Trait Real 

Source
pub trait Real:
    Float
    + Add
    + AddAssign
    + Sub
    + SubAssign
    + Mul
    + MulAssign
    + Div
    + DivAssign
    + Copy
    + Clone
    + Pi
    + IntoDegrees
    + IntoRadians
    + PartialEq
    + PartialOrd
    + Debug
    + Display {
    // Required methods
    fn is_f32() -> bool;
    fn is_f64() -> bool;
    fn float_type() -> FloatType;
    fn as_f32(self) -> f32;
    fn as_f64(self) -> f64;
}
Expand description

This type represents a real number. A macro trait that makes using generic floats much easier

Required Methods§

Source

fn is_f32() -> bool

Is this type a single-precision floating point. Useful for identifying the underlying representation for SIMD purposes

Source

fn is_f64() -> bool

Is this type a double-precision floating point. Useful for identifying the underlying representation for SIMD purposes

Source

fn float_type() -> FloatType

Return the floating point type as an enum. Mostly just a convinience instead of using is_f32() or is_f64()

Source

fn as_f32(self) -> f32

Force get this value as single-precision

Source

fn as_f64(self) -> f64

Force get this value as double-precision

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

Source§

impl Real for f64

Implementors§