pub trait FloatExt: Sized + Sealed {
Show 24 methods
// Required methods
fn cospi(self) -> Self;
fn error_function(self) -> Self;
fn complementary_error_function(self) -> Self;
fn inv_complementary_error_function(self) -> Self;
fn scaled_complementary_error_function(self) -> Self;
fn frexp(self) -> (Self, i32);
fn unbiased_exp(self) -> i32;
fn j0(self) -> Self;
fn j1(self) -> Self;
fn jn(self, order: i32) -> Self;
fn ldexp(self, exp: i32) -> Self;
fn log_gamma(self) -> Self;
fn log1p(self) -> Self;
fn norm_cdf(self) -> Self;
fn inv_norm_cdf(self) -> Self;
fn rcbrt(self) -> Self;
fn saturate(self) -> Self;
fn scale_by_n(self, exp: i32) -> Self;
fn sincospi(self) -> (Self, Self);
fn sinpi(self) -> Self;
fn gamma(self) -> Self;
fn y0(self) -> Self;
fn y1(self) -> Self;
fn yn(self, order: i32) -> Self;
}
Expand description
Extension trait for f32
and f64
which provides high level functions for
low level intrinsics for common math operations. You should generally use
these functions over “manual” implementations because they are often much faster.
Note that these link to libdevice intrinsics, so these functions cannot be used in cpu code, or they will fail to link.
Required Methods§
Sourcefn error_function(self) -> Self
fn error_function(self) -> Self
The value of the error function 2/\sqrt{pi} \int_0^x e^{-t^2} dt
.
Sourcefn complementary_error_function(self) -> Self
fn complementary_error_function(self) -> Self
The value of the complementary error function 1 - [error_function](Self::error_function)
.
Sourcefn inv_complementary_error_function(self) -> Self
fn inv_complementary_error_function(self) -> Self
Tries to find the value of x
that satisfies Self = complementary_error_function(x)
. Where
Self
is in the interval [0
, 2
].
Sourcefn scaled_complementary_error_function(self) -> Self
fn scaled_complementary_error_function(self) -> Self
The value of the scaled complementary error function, e^x^2 * self.complementary_error_function()
.
Sourcefn frexp(self) -> (Self, i32)
fn frexp(self) -> (Self, i32)
Decomposes self into a fractional component (which will be either 0, or in the range of 0.5..1.0) and an exponent.
Aka, self = fractional * 2^exponent
.
Sourcefn unbiased_exp(self) -> i32
fn unbiased_exp(self) -> i32
The unbiased integer exponent of self.
Sourcefn j0(self) -> Self
fn j0(self) -> Self
The value of the bessel function of the first kind of order 0 for self. J_0(self)
.
Sourcefn j1(self) -> Self
fn j1(self) -> Self
The value of the bessel function of the first kind of order 1 for self. J_1(self)
.
Sourcefn jn(self, order: i32) -> Self
fn jn(self, order: i32) -> Self
The value of the bessel function of the first kind of order n for self. J_n(self)
.
Sourcefn log_gamma(self) -> Self
fn log_gamma(self) -> Self
The natural logarithm of the absolute value of the gamma function. log_e (\int_0^\inf e^-t t^{x-1} dt)
Sourcefn norm_cdf(self) -> Self
fn norm_cdf(self) -> Self
The cumulative distribution function of the standard normal distribution for self. \phi(self)
.
Sourcefn inv_norm_cdf(self) -> Self
fn inv_norm_cdf(self) -> Self
The inverse cumulative distribution function of the standard normal distribution for self. \phi^-1(self)
.
This function is defined for input values in the interval (0, 1).
Sourcefn scale_by_n(self, exp: i32) -> Self
fn scale_by_n(self, exp: i32) -> Self
Scales self by 2^n
(self * 2^n
) efficiently.
Sourcefn y0(self) -> Self
fn y0(self) -> Self
The value of the bessel function of the second kind of order 0 for self. Y_0(self)
.
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.