num_traits::float

Trait FloatConst

Source
pub trait FloatConst {
Show 19 methods // Required methods fn E() -> Self; fn FRAC_1_PI() -> Self; fn FRAC_1_SQRT_2() -> Self; fn FRAC_2_PI() -> Self; fn FRAC_2_SQRT_PI() -> Self; fn FRAC_PI_2() -> Self; fn FRAC_PI_3() -> Self; fn FRAC_PI_4() -> Self; fn FRAC_PI_6() -> Self; fn FRAC_PI_8() -> Self; fn LN_10() -> Self; fn LN_2() -> Self; fn LOG10_E() -> Self; fn LOG2_E() -> Self; fn PI() -> Self; fn SQRT_2() -> Self; // Provided methods fn TAU() -> Self where Self: Sized + Add<Self, Output = Self> { ... } fn LOG10_2() -> Self where Self: Sized + Div<Self, Output = Self> { ... } fn LOG2_10() -> Self where Self: Sized + Div<Self, Output = Self> { ... }
}

Required Methods§

Source

fn E() -> Self

Return Euler’s number.

Source

fn FRAC_1_PI() -> Self

Return 1.0 / π.

Source

fn FRAC_1_SQRT_2() -> Self

Return 1.0 / sqrt(2.0).

Source

fn FRAC_2_PI() -> Self

Return 2.0 / π.

Source

fn FRAC_2_SQRT_PI() -> Self

Return 2.0 / sqrt(π).

Source

fn FRAC_PI_2() -> Self

Return π / 2.0.

Source

fn FRAC_PI_3() -> Self

Return π / 3.0.

Source

fn FRAC_PI_4() -> Self

Return π / 4.0.

Source

fn FRAC_PI_6() -> Self

Return π / 6.0.

Source

fn FRAC_PI_8() -> Self

Return π / 8.0.

Source

fn LN_10() -> Self

Return ln(10.0).

Source

fn LN_2() -> Self

Return ln(2.0).

Source

fn LOG10_E() -> Self

Return log10(e).

Source

fn LOG2_E() -> Self

Return log2(e).

Source

fn PI() -> Self

Return Archimedes’ constant π.

Source

fn SQRT_2() -> Self

Return sqrt(2.0).

Provided Methods§

Source

fn TAU() -> Self
where Self: Sized + Add<Self, Output = Self>,

Return the full circle constant τ.

Source

fn LOG10_2() -> Self
where Self: Sized + Div<Self, Output = Self>,

Return log10(2.0).

Source

fn LOG2_10() -> Self
where Self: Sized + Div<Self, Output = Self>,

Return log2(10.0).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FloatConst for f32

Source§

fn E() -> Self

Source§

fn FRAC_1_PI() -> Self

Source§

fn FRAC_1_SQRT_2() -> Self

Source§

fn FRAC_2_PI() -> Self

Source§

fn FRAC_2_SQRT_PI() -> Self

Source§

fn FRAC_PI_2() -> Self

Source§

fn FRAC_PI_3() -> Self

Source§

fn FRAC_PI_4() -> Self

Source§

fn FRAC_PI_6() -> Self

Source§

fn FRAC_PI_8() -> Self

Source§

fn LN_10() -> Self

Source§

fn LN_2() -> Self

Source§

fn LOG10_E() -> Self

Source§

fn LOG2_E() -> Self

Source§

fn PI() -> Self

Source§

fn SQRT_2() -> Self

Source§

fn TAU() -> Self

Source§

fn LOG10_2() -> Self

Source§

fn LOG2_10() -> Self

Source§

impl FloatConst for f64

Source§

fn E() -> Self

Source§

fn FRAC_1_PI() -> Self

Source§

fn FRAC_1_SQRT_2() -> Self

Source§

fn FRAC_2_PI() -> Self

Source§

fn FRAC_2_SQRT_PI() -> Self

Source§

fn FRAC_PI_2() -> Self

Source§

fn FRAC_PI_3() -> Self

Source§

fn FRAC_PI_4() -> Self

Source§

fn FRAC_PI_6() -> Self

Source§

fn FRAC_PI_8() -> Self

Source§

fn LN_10() -> Self

Source§

fn LN_2() -> Self

Source§

fn LOG10_E() -> Self

Source§

fn LOG2_E() -> Self

Source§

fn PI() -> Self

Source§

fn SQRT_2() -> Self

Source§

fn TAU() -> Self

Source§

fn LOG10_2() -> Self

Source§

fn LOG2_10() -> Self

Implementors§