pub trait Constants: Sized {
Show 16 methods
// Required methods
fn epsilon() -> Self;
fn negative_one() -> Self;
fn one_div_2() -> Self;
fn pi() -> Self;
fn two_pi() -> Self;
fn pi_div_2() -> Self;
fn two() -> Self;
fn max_finite() -> Self;
fn min_finite() -> Self;
fn ln_2() -> Self;
fn ln_10() -> Self;
fn log10_2() -> Self;
fn log2_10() -> Self;
fn log2_e() -> Self;
fn log10_e() -> Self;
fn e() -> Self;
}
Expand description
Provides fundamental mathematical constants.
Required Methods§
Sourcefn epsilon() -> Self
fn epsilon() -> Self
Machine epsilon value for Self
.
This is the difference between 1.0
and the next larger representable number.
Sourcefn negative_one() -> Self
fn negative_one() -> Self
Build and return the (floating point) value -1. represented by the proper type.
Sourcefn one_div_2() -> Self
fn one_div_2() -> Self
Build and return the (floating point) value 0.5 represented by the proper type.
Sourcefn two_pi() -> Self
fn two_pi() -> Self
Build and return the (floating point) value 2 π
represented by the proper type.
Sourcefn pi_div_2() -> Self
fn pi_div_2() -> Self
Build and return the (floating point) value π/2
represented by the proper type.
Sourcefn two() -> Self
fn two() -> Self
Build and return the (floating point) value 2. represented by the proper type.
Sourcefn max_finite() -> Self
fn max_finite() -> Self
Build and return the maximum finite value allowed by the current floating point representation.
Sourcefn min_finite() -> Self
fn min_finite() -> Self
Build and return the minimum finite (i.e., the most negative) value allowed by the current floating point representation.
Sourcefn ln_2() -> Self
fn ln_2() -> Self
Build and return the natural logarithm of 2, i.e. the (floating point) value ln(2)
, represented by the proper type.
Sourcefn ln_10() -> Self
fn ln_10() -> Self
Build and return the natural logarithm of 10, i.e. the (floating point) value ln(10)
, represented by the proper type.
Sourcefn log10_2() -> Self
fn log10_2() -> Self
Build and return the base-10 logarithm of 2, i.e. the (floating point) value Log_10(2)
, represented by the proper type.
Sourcefn log2_10() -> Self
fn log2_10() -> Self
Build and return the base-2 logarithm of 10, i.e. the (floating point) value Log_2(10)
, represented by the proper type.
Sourcefn log2_e() -> Self
fn log2_e() -> Self
Build and return the base-2 logarithm of e
, i.e. the (floating point) value Log_2(e)
, represented by the proper type.
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 Constants for f64
impl Constants for f64
Source§fn epsilon() -> Self
fn epsilon() -> Self
Machine epsilon value for f64
.
This is the difference between 1.0
and the next larger representable number.
Source§fn negative_one() -> Self
fn negative_one() -> Self
Build and return the (floating point) value -1. represented by a f64
.
Source§fn one_div_2() -> Self
fn one_div_2() -> Self
Build and return the (floating point) value 0.5 represented by the proper type.
Source§fn max_finite() -> Self
fn max_finite() -> Self
Build and return the maximum finite value allowed by the current floating point representation.
Source§fn min_finite() -> Self
fn min_finite() -> Self
Build and return the minimum finite (i.e., the most negative) value allowed by the current floating point representation.
Source§fn ln_2() -> Self
fn ln_2() -> Self
Build and return the natural logarithm of 2, i.e. the (floating point) value ln(2)
.
Source§fn ln_10() -> Self
fn ln_10() -> Self
Build and return the natural logarithm of 10, i.e. the (floating point) value ln(10)
.
Source§fn log10_2() -> Self
fn log10_2() -> Self
Build and return the base-10 logarithm of 2, i.e. the (floating point) value Log_10(2)
.
Source§fn log2_10() -> Self
fn log2_10() -> Self
Build and return the base-2 logarithm of 10, i.e. the (floating point) value Log_2(10)
.
Source§fn log2_e() -> Self
fn log2_e() -> Self
Build and return the base-2 logarithm of e
, i.e. the (floating point) value Log_2(e)
.