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§
Sourceconst NAN: Self
const NAN: Self
Scalar equivalent of np.nan.
use rustnum as np;
assert!(<f64 as np::Float>::NAN.is_nan());Sourceconst INFINITY: Self
const INFINITY: Self
Scalar equivalent of np.inf.
use rustnum as np;
assert!(<f64 as np::Float>::INFINITY.is_infinite());Sourceconst NEG_INFINITY: Self
const NEG_INFINITY: Self
Scalar equivalent of np.negative(inf).
use rustnum as np;
assert!(<f64 as np::Float>::NEG_INFINITY.is_infinite());Sourceconst EPSILON: Self
const EPSILON: Self
Scalar equivalent of np.finfo.eps.
use rustnum as np;
assert!(<f64 as np::Float>::EPSILON>0.0);Required Methods§
Sourcefn exp(self) -> Self
fn exp(self) -> Self
Scalar equivalent of np.exp.
use rustnum as np;
assert!(<f64 as np::Float>::exp(0.5).is_finite());Sourcefn exp2(self) -> Self
fn exp2(self) -> Self
Scalar equivalent of np.exp2.
use rustnum as np;
assert!(<f64 as np::Float>::exp2(0.5).is_finite());Sourcefn exp_m1(self) -> Self
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());Sourcefn ln(self) -> Self
fn ln(self) -> Self
Scalar equivalent of np.log.
use rustnum as np;
assert!(<f64 as np::Float>::ln(0.5).is_finite());Sourcefn log2(self) -> Self
fn log2(self) -> Self
Scalar equivalent of np.log2.
use rustnum as np;
assert!(<f64 as np::Float>::log2(0.5).is_finite());Sourcefn log10(self) -> Self
fn log10(self) -> Self
Scalar equivalent of np.log10.
use rustnum as np;
assert!(<f64 as np::Float>::log10(0.5).is_finite());Sourcefn ln_1p(self) -> Self
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());Sourcefn sqrt(self) -> Self
fn sqrt(self) -> Self
Scalar equivalent of np.sqrt.
use rustnum as np;
assert!(<f64 as np::Float>::sqrt(0.5).is_finite());Sourcefn cbrt(self) -> Self
fn cbrt(self) -> Self
Scalar equivalent of np.cbrt.
use rustnum as np;
assert!(<f64 as np::Float>::cbrt(0.5).is_finite());Sourcefn sin(self) -> Self
fn sin(self) -> Self
Scalar equivalent of np.sin.
use rustnum as np;
assert!(<f64 as np::Float>::sin(0.5).is_finite());Sourcefn cos(self) -> Self
fn cos(self) -> Self
Scalar equivalent of np.cos.
use rustnum as np;
assert!(<f64 as np::Float>::cos(0.5).is_finite());Sourcefn tan(self) -> Self
fn tan(self) -> Self
Scalar equivalent of np.tan.
use rustnum as np;
assert!(<f64 as np::Float>::tan(0.5).is_finite());Sourcefn asin(self) -> Self
fn asin(self) -> Self
Scalar equivalent of np.arcsin.
use rustnum as np;
assert!(<f64 as np::Float>::asin(0.5).is_finite());Sourcefn acos(self) -> Self
fn acos(self) -> Self
Scalar equivalent of np.arccos.
use rustnum as np;
assert!(<f64 as np::Float>::acos(0.5).is_finite());Sourcefn atan(self) -> Self
fn atan(self) -> Self
Scalar equivalent of np.arctan.
use rustnum as np;
assert!(<f64 as np::Float>::atan(0.5).is_finite());Sourcefn sinh(self) -> Self
fn sinh(self) -> Self
Scalar equivalent of np.sinh.
use rustnum as np;
assert!(<f64 as np::Float>::sinh(0.5).is_finite());Sourcefn cosh(self) -> Self
fn cosh(self) -> Self
Scalar equivalent of np.cosh.
use rustnum as np;
assert!(<f64 as np::Float>::cosh(0.5).is_finite());Sourcefn tanh(self) -> Self
fn tanh(self) -> Self
Scalar equivalent of np.tanh.
use rustnum as np;
assert!(<f64 as np::Float>::tanh(0.5).is_finite());Sourcefn floor(self) -> Self
fn floor(self) -> Self
Scalar equivalent of np.floor.
use rustnum as np;
assert!(<f64 as np::Float>::floor(0.5).is_finite());Sourcefn ceil(self) -> Self
fn ceil(self) -> Self
Scalar equivalent of np.ceil.
use rustnum as np;
assert!(<f64 as np::Float>::ceil(0.5).is_finite());Sourcefn round(self) -> Self
fn round(self) -> Self
Scalar equivalent of np.round.
use rustnum as np;
assert!(<f64 as np::Float>::round(0.5).is_finite());Sourcefn trunc(self) -> Self
fn trunc(self) -> Self
Scalar equivalent of np.trunc.
use rustnum as np;
assert!(<f64 as np::Float>::trunc(0.5).is_finite());Sourcefn powf(self, p: Self) -> Self
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());Sourcefn powi(self, p: i32) -> Self
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());Sourcefn is_nan(self) -> bool
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);Sourcefn is_infinite(self) -> bool
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);Sourcefn is_finite(self) -> bool
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);Sourcefn atan2(self, o: Self) -> Self
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());Sourcefn hypot(self, o: Self) -> Self
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());Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".