Skip to main content

Float

Trait Float 

Source
pub trait Float:
    Num
    + Neg<Output = Self>
    + FloatHooks {
    const NAN: Self;
    const INFINITY: Self;
    const NEG_INFINITY: Self;
    const EPSILON: Self;
    const PI: Self;
    const E: Self;
Show 31 methods // Required methods fn exp(self) -> Self; fn exp2(self) -> Self; fn exp_m1(self) -> Self; fn ln(self) -> Self; fn log2(self) -> Self; fn log10(self) -> Self; fn ln_1p(self) -> Self; fn sqrt(self) -> Self; fn cbrt(self) -> Self; fn sin(self) -> Self; fn cos(self) -> Self; fn tan(self) -> Self; fn asin(self) -> Self; fn acos(self) -> Self; fn atan(self) -> Self; fn sinh(self) -> Self; fn cosh(self) -> Self; fn tanh(self) -> Self; fn floor(self) -> Self; fn ceil(self) -> Self; fn round(self) -> Self; fn trunc(self) -> Self; fn powf(self, p: Self) -> Self; fn powi(self, p: i32) -> Self; fn is_nan(self) -> bool; fn is_infinite(self) -> bool; fn is_finite(self) -> bool; fn atan2(self, o: Self) -> Self; fn hypot(self, o: Self) -> Self; fn max(self, o: Self) -> Self; fn min(self, o: Self) -> Self;
}
Expand description

A floating point array element, like NumPy floating dtypes.

use rustnum as np;
assert!(<f64 as np::Float>::PI>3.0);

Float has a hidden, sealed supertrait (FloatHooks) that carries the bit-level helpers and constants of the f32/f64 kernels. Its items never clash with Float/Num/Element, so generic code bounded by F: Float can call every Array<F> method.

Required Associated Constants§

Source

const NAN: Self

Scalar equivalent of np.nan.

use rustnum as np;
assert!(<f64 as np::Float>::NAN.is_nan());
Source

const INFINITY: Self

Scalar equivalent of np.inf.

use rustnum as np;
assert!(<f64 as np::Float>::INFINITY.is_infinite());
Source

const NEG_INFINITY: Self

Scalar equivalent of np.negative(inf).

use rustnum as np;
assert!(<f64 as np::Float>::NEG_INFINITY.is_infinite());
Source

const EPSILON: Self

Scalar equivalent of np.finfo.eps.

use rustnum as np;
assert!(<f64 as np::Float>::EPSILON>0.0);
Source

const PI: Self

Scalar equivalent of np.pi.

use rustnum as np;
assert!(<f64 as np::Float>::PI>0.0);
Source

const E: Self

Scalar equivalent of np.e.

use rustnum as np;
assert!(<f64 as np::Float>::E>0.0);

Required Methods§

Source

fn exp(self) -> Self

Scalar equivalent of np.exp.

use rustnum as np;
assert!(<f64 as np::Float>::exp(0.5).is_finite());
Source

fn exp2(self) -> Self

Scalar equivalent of np.exp2.

use rustnum as np;
assert!(<f64 as np::Float>::exp2(0.5).is_finite());
Source

fn exp_m1(self) -> Self

Scalar equivalent of np.expm1.

use rustnum as np;
assert!(<f64 as np::Float>::exp_m1(0.5).is_finite());
Source

fn ln(self) -> Self

Scalar equivalent of np.log.

use rustnum as np;
assert!(<f64 as np::Float>::ln(0.5).is_finite());
Source

fn log2(self) -> Self

Scalar equivalent of np.log2.

use rustnum as np;
assert!(<f64 as np::Float>::log2(0.5).is_finite());
Source

fn log10(self) -> Self

Scalar equivalent of np.log10.

use rustnum as np;
assert!(<f64 as np::Float>::log10(0.5).is_finite());
Source

fn ln_1p(self) -> Self

Scalar equivalent of np.log1p.

use rustnum as np;
assert!(<f64 as np::Float>::ln_1p(0.5).is_finite());
Source

fn sqrt(self) -> Self

Scalar equivalent of np.sqrt.

use rustnum as np;
assert!(<f64 as np::Float>::sqrt(0.5).is_finite());
Source

fn cbrt(self) -> Self

Scalar equivalent of np.cbrt.

use rustnum as np;
assert!(<f64 as np::Float>::cbrt(0.5).is_finite());
Source

fn sin(self) -> Self

Scalar equivalent of np.sin.

use rustnum as np;
assert!(<f64 as np::Float>::sin(0.5).is_finite());
Source

fn cos(self) -> Self

Scalar equivalent of np.cos.

use rustnum as np;
assert!(<f64 as np::Float>::cos(0.5).is_finite());
Source

fn tan(self) -> Self

Scalar equivalent of np.tan.

use rustnum as np;
assert!(<f64 as np::Float>::tan(0.5).is_finite());
Source

fn asin(self) -> Self

Scalar equivalent of np.arcsin.

use rustnum as np;
assert!(<f64 as np::Float>::asin(0.5).is_finite());
Source

fn acos(self) -> Self

Scalar equivalent of np.arccos.

use rustnum as np;
assert!(<f64 as np::Float>::acos(0.5).is_finite());
Source

fn atan(self) -> Self

Scalar equivalent of np.arctan.

use rustnum as np;
assert!(<f64 as np::Float>::atan(0.5).is_finite());
Source

fn sinh(self) -> Self

Scalar equivalent of np.sinh.

use rustnum as np;
assert!(<f64 as np::Float>::sinh(0.5).is_finite());
Source

fn cosh(self) -> Self

Scalar equivalent of np.cosh.

use rustnum as np;
assert!(<f64 as np::Float>::cosh(0.5).is_finite());
Source

fn tanh(self) -> Self

Scalar equivalent of np.tanh.

use rustnum as np;
assert!(<f64 as np::Float>::tanh(0.5).is_finite());
Source

fn floor(self) -> Self

Scalar equivalent of np.floor.

use rustnum as np;
assert!(<f64 as np::Float>::floor(0.5).is_finite());
Source

fn ceil(self) -> Self

Scalar equivalent of np.ceil.

use rustnum as np;
assert!(<f64 as np::Float>::ceil(0.5).is_finite());
Source

fn round(self) -> Self

Scalar equivalent of np.round.

use rustnum as np;
assert!(<f64 as np::Float>::round(0.5).is_finite());
Source

fn trunc(self) -> Self

Scalar equivalent of np.trunc.

use rustnum as np;
assert!(<f64 as np::Float>::trunc(0.5).is_finite());
Source

fn powf(self, p: Self) -> Self

Scalar equivalent of np.power.

use rustnum as np;
assert!(<f64 as np::Float>::powf(0.5,2.0).is_finite());
Source

fn powi(self, p: i32) -> Self

Scalar equivalent of np.power.

use rustnum as np;
assert!(<f64 as np::Float>::powi(0.5,2).is_finite());
Source

fn is_nan(self) -> bool

Scalar equivalent of np.isnan.

use rustnum as np;
assert_eq!(<f64 as np::Float>::is_nan(0.5),false);
Source

fn is_infinite(self) -> bool

Scalar equivalent of np.isinf.

use rustnum as np;
assert_eq!(<f64 as np::Float>::is_infinite(0.5),false);
Source

fn is_finite(self) -> bool

Scalar equivalent of np.isfinite.

use rustnum as np;
assert_eq!(<f64 as np::Float>::is_finite(0.5),true);
Source

fn atan2(self, o: Self) -> Self

Scalar equivalent of np.atan2.

use rustnum as np;
assert!(<f64 as np::Float>::atan2(0.5,1.0).is_finite());
Source

fn hypot(self, o: Self) -> Self

Scalar equivalent of np.hypot.

use rustnum as np;
assert!(<f64 as np::Float>::hypot(0.5,1.0).is_finite());
Source

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

Scalar equivalent of np.maximum.

use rustnum as np;
assert!(<f64 as np::Float>::max(0.5,1.0).is_finite());
Source

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

Scalar equivalent of np.minimum.

use rustnum as np;
assert!(<f64 as np::Float>::min(0.5,1.0).is_finite());

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Float for f32

Source§

const NAN: Self = f32::NAN

Source§

const INFINITY: Self = f32::INFINITY

Source§

const NEG_INFINITY: Self = f32::NEG_INFINITY

Source§

const EPSILON: Self = f32::EPSILON

Source§

const PI: Self

Source§

const E: Self

Source§

fn exp(self) -> Self

Source§

fn exp2(self) -> Self

Source§

fn exp_m1(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn log2(self) -> Self

Source§

fn log10(self) -> Self

Source§

fn ln_1p(self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn acos(self) -> Self

Source§

fn atan(self) -> Self

Source§

fn sinh(self) -> Self

Source§

fn cosh(self) -> Self

Source§

fn tanh(self) -> Self

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn trunc(self) -> Self

Source§

fn powf(self, p: Self) -> Self

Source§

fn powi(self, p: i32) -> Self

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn atan2(self, o: Self) -> Self

Source§

fn hypot(self, o: Self) -> Self

Source§

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

Source§

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

Source§

impl Float for f64

Source§

const NAN: Self = f64::NAN

Source§

const INFINITY: Self = f64::INFINITY

Source§

const NEG_INFINITY: Self = f64::NEG_INFINITY

Source§

const EPSILON: Self = f64::EPSILON

Source§

const PI: Self

Source§

const E: Self

Source§

fn exp(self) -> Self

Source§

fn exp2(self) -> Self

Source§

fn exp_m1(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn log2(self) -> Self

Source§

fn log10(self) -> Self

Source§

fn ln_1p(self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn acos(self) -> Self

Source§

fn atan(self) -> Self

Source§

fn sinh(self) -> Self

Source§

fn cosh(self) -> Self

Source§

fn tanh(self) -> Self

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn trunc(self) -> Self

Source§

fn powf(self, p: Self) -> Self

Source§

fn powi(self, p: i32) -> Self

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn atan2(self, o: Self) -> Self

Source§

fn hypot(self, o: Self) -> Self

Source§

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

Source§

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

Implementors§