Trait std::num::FloatMathUnstable [-]  [+] [src]

pub trait FloatMath: Float {
    fn ldexp(x: Self, exp: int) -> Self;
    fn frexp(self) -> (Self, int);
    fn next_after(self, other: Self) -> Self;
    fn max(self, other: Self) -> Self;
    fn min(self, other: Self) -> Self;
    fn abs_sub(self, other: Self) -> Self;
    fn cbrt(self) -> Self;
    fn hypot(self, other: 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 atan2(self, other: Self) -> Self;
    fn sin_cos(self) -> (Self, Self);
    fn exp_m1(self) -> Self;
    fn ln_1p(self) -> Self;
    fn sinh(self) -> Self;
    fn cosh(self) -> Self;
    fn tanh(self) -> Self;
    fn asinh(self) -> Self;
    fn acosh(self) -> Self;
    fn atanh(self) -> Self;
}

Mathematical operations on primitive floating point numbers.

Required Methods

fn ldexp(x: Self, exp: int) -> Self

Constructs a floating point number created by multiplying x by 2 raised to the power of exp.

fn frexp(self) -> (Self, int)

Breaks the number into a normalized fraction and a base-2 exponent, satisfying:

  • self = x * pow(2, exp)

  • 0.5 <= abs(x) < 1.0

fn next_after(self, other: Self) -> Self

Returns the next representable floating-point value in the direction of other.

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

Returns the maximum of the two numbers.

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

Returns the minimum of the two numbers.

fn abs_sub(self, other: Self) -> Self

The positive difference of two numbers. Returns 0.0 if the number is less than or equal to other, otherwise the difference betweenself and other is returned.

fn cbrt(self) -> Self

Take the cubic root of a number.

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

Calculate the length of the hypotenuse of a right-angle triangle given legs of length x and y.

fn sin(self) -> Self

Computes the sine of a number (in radians).

fn cos(self) -> Self

Computes the cosine of a number (in radians).

fn tan(self) -> Self

Computes the tangent of a number (in radians).

fn asin(self) -> Self

Computes the arcsine of a number. Return value is in radians in the range [-pi/2, pi/2] or NaN if the number is outside the range [-1, 1].

fn acos(self) -> Self

Computes the arccosine of a number. Return value is in radians in the range [0, pi] or NaN if the number is outside the range [-1, 1].

fn atan(self) -> Self

Computes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2];

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

Computes the four quadrant arctangent of a number, y, and another number x. Return value is in radians in the range [-pi, pi].

fn sin_cos(self) -> (Self, Self)

Simultaneously computes the sine and cosine of the number, x. Returns (sin(x), cos(x)).

fn exp_m1(self) -> Self

Returns the exponential of the number, minus 1, in a way that is accurate even if the number is close to zero.

fn ln_1p(self) -> Self

Returns the natural logarithm of the number plus 1 (ln(1+n)) more accurately than if the operations were performed separately.

fn sinh(self) -> Self

Hyperbolic sine function.

fn cosh(self) -> Self

Hyperbolic cosine function.

fn tanh(self) -> Self

Hyperbolic tangent function.

fn asinh(self) -> Self

Inverse hyperbolic sine function.

fn acosh(self) -> Self

Inverse hyperbolic cosine function.

fn atanh(self) -> Self

Inverse hyperbolic tangent function.

Implementors