pub trait FloatExt: Sized + Sealed {
Show 24 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
fn 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
.
fn complementary_error_function(self) -> Self
fn complementary_error_function(self) -> Self
The value of the complementary error function 1 - [error_function](Self::error_function)
.
fn 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
].
fn 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()
.
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
.
fn unbiased_exp(self) -> i32
fn unbiased_exp(self) -> i32
The unbiased integer exponent of self.
The value of the bessel function of the first kind of order 0 for self. J_0(self)
.
The value of the bessel function of the first kind of order 1 for self. J_1(self)
.
The value of the bessel function of the first kind of order n for self. J_n(self)
.
The natural logarithm of the absolute value of the gamma function. log_e (\int_0^\inf e^-t t^{x-1} dt)
The cumulative distribution function of the standard normal distribution for self. \phi(self)
.
fn 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).
fn scale_by_n(self, exp: i32) -> Self
fn scale_by_n(self, exp: i32) -> Self
Scales self by 2^n
(self * 2^n
) efficiently.
The value of the bessel function of the second kind of order 0 for self. Y_0(self)
.
The value of the bessel function of the second kind of order 1 for self. Y_1(self)
.