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

The cosine of self * pi (measured in radians).

The value of the error function 2/\sqrt{pi} \int_0^x e^{-t^2} dt.

The value of the complementary error function 1 - [error_function](Self::error_function).

Tries to find the value of x that satisfies Self = complementary_error_function(x). Where Self is in the interval [0, 2].

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.

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 value of self * 2^exp.

The natural logarithm of the absolute value of the gamma function. log_e (\int_0^\inf e^-t t^{x-1} dt)

The natural logarithm of 1 + self, log_e(1 + self)

The cumulative distribution function of the standard normal distribution for self. \phi(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).

The reciprocal cube root of self.

Clamp self to [+0.0, 1.0].

Scales self by 2^n (self * 2^n) efficiently.

The sine and cosine of self * pi (measured in radians).

The sine of self * pi (measured in radians).

The gamma function of self, \int_0^\inf e^-t t^{x-1} dt.

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).

The value of the bessel function of the second kind of order n for self. Y_n(self).

Implementations on Foreign Types

Implementors