[][src]Trait maths_traits::analysis::real::Real

pub trait Real: ArchField + ComplexSubset<Real = Self> + Trig + RealExponential {
    fn approx(self) -> f64;
fn repr(f: f64) -> Self; }

A type representing the real numbers

Note that in order to accomidate the primitive floats, this trait does technically allow for special values such as infinity and NaN to return from operations as error codes, but usage of such values is discouraged in favor of alternative functions that return optional values instead

Required methods

fn approx(self) -> f64

Approximates this real number as a 64-bit floating point

This is meant as a convenient way to interface with code using primitives, and in most cases, this will exactly represent the given value since most real representations are 32 or 64-bit floats However, this is not always the case, and the returned value is only guaranteed to be within the precision of an f64.

fn repr(f: f64) -> Self

Constructs a real number from a 64-bit floating point

This is meant to be a convenient way to input constants into algorithms with generics and to interface with code using primitives, and in most cases, this should constant fold and represent the given value precisely. However, there is no guarantee of this as the representation returned could have a different precision than the f64

Loading content...

Implementations on Foreign Types

impl Real for f32[src]

impl Real for f64[src]

Loading content...

Implementors

Loading content...