Skip to main content

Real

Trait Real 

Source
pub trait Real:
    Num
    + Signed
    + Div<Output = Self>
    + Rem<Output = Self>
    + PartialOrd {
Show 46 methods // Required methods fn from_f64(v: f64) -> Self; fn to_f64(self) -> f64; fn sqrt(self) -> Self; fn cbrt(self) -> Self; fn powf(self, e: Self) -> Self; fn powi(self, e: i32) -> Self; fn exp(self) -> Self; fn exp_m1(self) -> Self; fn ln(self) -> Self; fn ln_1p(self) -> Self; fn log(self, base: Self) -> Self; fn log10(self) -> Self; fn log2(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 sinh(self) -> Self; fn cosh(self) -> Self; fn tanh(self) -> Self; fn asinh(self) -> Self; fn acosh(self) -> Self; fn atanh(self) -> Self; fn sin_cos(self) -> (Self, Self); fn hypot(self, other: Self) -> Self; fn copysign(self, other: Self) -> Self; fn abs_sub(self, other: Self) -> Self; fn recip(self) -> Self; fn floor(self) -> Self; fn ceil(self) -> Self; fn round(self) -> Self; fn trunc(self) -> Self; fn fract(self) -> Self; fn min(self, other: Self) -> Self; fn max(self, other: Self) -> Self; fn is_finite(self) -> bool; fn is_nan(self) -> bool; fn is_infinite(self) -> bool; fn is_normal(self) -> bool; fn is_subnormal(self) -> bool; fn is_sign_negative(self) -> bool; fn is_sign_positive(self) -> bool; fn signum(self) -> Self;
}
Expand description

Real numbers: transcendental functions, powers, rounding, classification.

Implemented for f32 and f64. Functions take radians unless a *_deg variant exists.

Required Methods§

Source

fn from_f64(v: f64) -> Self

Convert from f64.

Source

fn to_f64(self) -> f64

Convert to f64.

Source

fn sqrt(self) -> Self

Square root.

Source

fn cbrt(self) -> Self

Cube root.

Source

fn powf(self, e: Self) -> Self

Raise to a floating-point power.

Source

fn powi(self, e: i32) -> Self

Raise to an integer power.

Source

fn exp(self) -> Self

e^self.

Source

fn exp_m1(self) -> Self

e^self - 1, accurate for small self.

Source

fn ln(self) -> Self

Natural logarithm.

Source

fn ln_1p(self) -> Self

ln(1 + self), accurate for small self.

Source

fn log(self, base: Self) -> Self

Logarithm with arbitrary base.

Source

fn log10(self) -> Self

Log base 10.

Source

fn log2(self) -> Self

Log base 2.

Source

fn sin(self) -> Self

Sine (radians).

Source

fn cos(self) -> Self

Cosine (radians).

Source

fn tan(self) -> Self

Tangent (radians).

Source

fn asin(self) -> Self

Arcsine.

Source

fn acos(self) -> Self

Arccosine.

Source

fn atan(self) -> Self

Arctangent.

Source

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

Two-argument arctangent: atan(self / other).

Source

fn sinh(self) -> Self

Hyperbolic sine.

Source

fn cosh(self) -> Self

Hyperbolic cosine.

Source

fn tanh(self) -> Self

Hyperbolic tangent.

Source

fn asinh(self) -> Self

Inverse hyperbolic sine.

Source

fn acosh(self) -> Self

Inverse hyperbolic cosine.

Source

fn atanh(self) -> Self

Inverse hyperbolic tangent.

Source

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

Sine and cosine simultaneously.

Source

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

Hypotenuse: sqrt(self^2 + other^2).

Source

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

Copy the sign of other to the magnitude of self.

Source

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

max(self - other, 0).

Source

fn recip(self) -> Self

Reciprocal: 1 / self.

Source

fn floor(self) -> Self

Floor: largest integer <= self.

Source

fn ceil(self) -> Self

Ceiling: smallest integer >= self.

Source

fn round(self) -> Self

Round to nearest integer.

Source

fn trunc(self) -> Self

Truncate toward zero.

Source

fn fract(self) -> Self

Fractional part: self - floor(self).

Source

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

Minimum of self and other.

Source

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

Maximum of self and other.

Source

fn is_finite(self) -> bool

Returns true if self is neither infinite nor NaN.

Source

fn is_nan(self) -> bool

Returns true if self is NaN.

Source

fn is_infinite(self) -> bool

Returns true if self is positive or negative infinity.

Source

fn is_normal(self) -> bool

Returns true if self is neither zero, infinite, subnormal, nor NaN.

Source

fn is_subnormal(self) -> bool

Returns true if self is subnormal (denormal).

Source

fn is_sign_negative(self) -> bool

Returns true if the sign bit is negative.

Source

fn is_sign_positive(self) -> bool

Returns true if the sign bit is positive (or zero).

Source

fn signum(self) -> Self

Returns -1, 0, or +1.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Real for f32

Source§

fn from_f64(v: f64) -> Self

Source§

fn to_f64(self) -> f64

Source§

fn sqrt(self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn powf(self, e: Self) -> Self

Source§

fn powi(self, e: i32) -> Self

Source§

fn exp(self) -> Self

Source§

fn exp_m1(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn ln_1p(self) -> Self

Source§

fn log(self, base: Self) -> Self

Source§

fn log10(self) -> Self

Source§

fn log2(self) -> Self

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn acos(self) -> Self

Source§

fn atan(self) -> Self

Source§

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

Source§

fn sinh(self) -> Self

Source§

fn cosh(self) -> Self

Source§

fn tanh(self) -> Self

Source§

fn asinh(self) -> Self

Source§

fn acosh(self) -> Self

Source§

fn atanh(self) -> Self

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn recip(self) -> Self

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn trunc(self) -> Self

Source§

fn fract(self) -> Self

Source§

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

Source§

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

Source§

fn is_finite(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn is_normal(self) -> bool

Source§

fn is_subnormal(self) -> bool

Source§

fn is_sign_negative(self) -> bool

Source§

fn is_sign_positive(self) -> bool

Source§

fn signum(self) -> Self

Source§

impl Real for f64

Source§

fn from_f64(v: f64) -> Self

Source§

fn to_f64(self) -> f64

Source§

fn sqrt(self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn powf(self, e: Self) -> Self

Source§

fn powi(self, e: i32) -> Self

Source§

fn exp(self) -> Self

Source§

fn exp_m1(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn ln_1p(self) -> Self

Source§

fn log(self, base: Self) -> Self

Source§

fn log10(self) -> Self

Source§

fn log2(self) -> Self

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn acos(self) -> Self

Source§

fn atan(self) -> Self

Source§

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

Source§

fn sinh(self) -> Self

Source§

fn cosh(self) -> Self

Source§

fn tanh(self) -> Self

Source§

fn asinh(self) -> Self

Source§

fn acosh(self) -> Self

Source§

fn atanh(self) -> Self

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn recip(self) -> Self

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn trunc(self) -> Self

Source§

fn fract(self) -> Self

Source§

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

Source§

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

Source§

fn is_finite(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn is_normal(self) -> bool

Source§

fn is_subnormal(self) -> bool

Source§

fn is_sign_negative(self) -> bool

Source§

fn is_sign_positive(self) -> bool

Source§

fn signum(self) -> Self

Implementors§