Skip to main content

Transcendental

Trait Transcendental 

Source
pub trait Transcendental: Scalar {
    const PI: Self;
Show 13 methods // Required methods fn to_f32(self) -> f32; fn from_f32(value: f32) -> Self; fn sqrt(self) -> Self; fn exp(self) -> Self; fn ln(self) -> Self; fn sin(self) -> Self; fn cos(self) -> Self; fn tan(self) -> Self; fn signum(self) -> Self; fn random() -> Self; // Provided methods fn to_f64(self) -> f64 { ... } fn from_f64(value: f64) -> Self { ... } fn tanh(self) -> Self { ... }
}
Expand description

Transcendental operations (sin, cos, sqrt, exp, ln).

Extends Scalar with functions available only for floating-point types (f32, f64).

Required Associated Constants§

Source

const PI: Self

The constant π (3.14159…).

Required Methods§

Source

fn to_f32(self) -> f32

Convert to f32.

Source

fn from_f32(value: f32) -> Self

Create from an f32 value.

Source

fn sqrt(self) -> Self

Compute the square root.

Source

fn exp(self) -> Self

Compute e raised to the power of self.

Source

fn ln(self) -> Self

Compute the natural logarithm.

Source

fn sin(self) -> Self

Compute the sine (input in radians).

Source

fn cos(self) -> Self

Compute the cosine (input in radians).

Source

fn tan(self) -> Self

Compute the tangent (input in radians).

Source

fn signum(self) -> Self

Return the sign of the value: -1, 0, or 1.

Source

fn random() -> Self

Generate a random value in the range [-1, 1].

Provided Methods§

Source

fn to_f64(self) -> f64

Convert to f64.

Source

fn from_f64(value: f64) -> Self

Create from an f64 value.

Source

fn tanh(self) -> Self

Compute the hyperbolic tangent.

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 Transcendental for f32

Source§

const PI: f32 = std::f32::consts::PI

Source§

fn to_f32(self) -> f32

Source§

fn from_f32(value: f32) -> f32

Source§

fn from_f64(value: f64) -> f32

Source§

fn sqrt(self) -> f32

Source§

fn exp(self) -> f32

Source§

fn ln(self) -> f32

Source§

fn sin(self) -> f32

Source§

fn cos(self) -> f32

Source§

fn tan(self) -> f32

Source§

fn tanh(self) -> f32

Source§

fn signum(self) -> f32

Source§

fn random() -> f32

Source§

impl Transcendental for f64

Source§

const PI: f64 = std::f64::consts::PI

Source§

fn to_f32(self) -> f32

Source§

fn from_f32(value: f32) -> f64

Source§

fn from_f64(value: f64) -> f64

Source§

fn sqrt(self) -> f64

Source§

fn exp(self) -> f64

Source§

fn ln(self) -> f64

Source§

fn sin(self) -> f64

Source§

fn cos(self) -> f64

Source§

fn tan(self) -> f64

Source§

fn tanh(self) -> f64

Source§

fn signum(self) -> f64

Source§

fn random() -> f64

Implementors§