Enum rug::float::Constant [−][src]
pub enum Constant { Log2, Pi, Euler, Catalan, // some variants omitted }
Expand description
The available floating-point constants.
Examples
use rug::{float::Constant, Float}; let log2 = Float::with_val(53, Constant::Log2); let pi = Float::with_val(53, Constant::Pi); let euler = Float::with_val(53, Constant::Euler); let catalan = Float::with_val(53, Constant::Catalan); assert_eq!(log2.to_string_radix(10, Some(5)), "6.9315e-1"); assert_eq!(pi.to_string_radix(10, Some(5)), "3.1416"); assert_eq!(euler.to_string_radix(10, Some(5)), "5.7722e-1"); assert_eq!(catalan.to_string_radix(10, Some(5)), "9.1597e-1");
Variants
The logarithm of two, 0.693147…
The value of pi, π = 3.14159…
Euler’s constant, also known as the Euler-Mascheroni constant, γ = 0.577215…
Note that this is not Euler’s number e, which can be obtained using
one of the exp
functions.
Catalan’s constant, 0.915965…
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Constant
impl UnwindSafe for Constant
Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Casts the value.
Casts the value.
Casts the value.
Casts the value.