Trait rust_decimal::MathematicalOps [−][src]
pub trait MathematicalOps { fn exp(&self) -> Decimal; fn exp_with_tolerance(&self, tolerance: Decimal) -> Decimal; fn powi(&self, exp: u64) -> Decimal; fn checked_powi(&self, exp: u64) -> Option<Decimal>; fn sqrt(&self) -> Option<Decimal>; fn ln(&self) -> Decimal; fn erf(&self) -> Decimal; fn norm_cdf(&self) -> Decimal; fn norm_pdf(&self) -> Decimal; }
Trait exposing various mathematical operations that can be applied using a Decimal. This is only
present when the maths
feature has been enabled.
Required methods
fn exp(&self) -> Decimal
[src]
The estimated exponential function, ex, rounded to 8 decimal places. Stops calculating when it is within tolerance of roughly 0.000002 in order to prevent multiplication overflow.
fn exp_with_tolerance(&self, tolerance: Decimal) -> Decimal
[src]
The estimated exponential function, ex, rounded to 8 decimal places. Stops
calculating when it is within tolerance
.
Multiplication overflows are likely if you are not careful with the size of tolerance
.
It is recommended to set the tolerance
larger for larger numbers and smaller for smaller
numbers to avoid multiplication overflow.
fn powi(&self, exp: u64) -> Decimal
[src]
Raise self to the given unsigned integer exponent: xy
fn checked_powi(&self, exp: u64) -> Option<Decimal>
[src]
Raise self to the given unsigned integer exponent xy returning
None
on overflow.
fn sqrt(&self) -> Option<Decimal>
[src]
The square root of a Decimal. Uses a standard Babylonian method.
fn ln(&self) -> Decimal
[src]
The natural logarithm for a Decimal. Uses a fast estimation algorithm This is more accurate on larger numbers and less on numbers less than 1.
fn erf(&self) -> Decimal
[src]
Abramowitz Approximation of Error Function from wikipedia
fn norm_cdf(&self) -> Decimal
[src]
The Cumulative distribution function for a Normal distribution
fn norm_pdf(&self) -> Decimal
[src]
The Probability density function for a Normal distribution
Implementors
impl MathematicalOps for Decimal
[src]
impl MathematicalOps for Decimal
[src]fn exp(&self) -> Decimal
[src]
The estimated exponential function, ex, rounded to 8 decimal places. Stops calculating when it is within tolerance of roughly 0.000002 in order to prevent multiplication overflow.
fn exp_with_tolerance(&self, tolerance: Decimal) -> Decimal
[src]
The estimated exponential function, ex, rounded to 8 decimal places. Stops
calculating when it is within tolerance
.
Multiplication overflows are likely if you are not careful with the size of tolerance
.
It is recommended to set the tolerance
larger for larger numbers and smaller for smaller
numbers to avoid multiplication overflow.
fn powi(&self, exp: u64) -> Decimal
[src]
Raise self to the given unsigned integer exponent: xy
fn checked_powi(&self, exp: u64) -> Option<Decimal>
[src]
fn sqrt(&self) -> Option<Decimal>
[src]
The square root of a Decimal. Uses a standard Babylonian method.
fn ln(&self) -> Decimal
[src]
The natural logarithm for a Decimal. Uses a fast estimation algorithm This is more accurate on larger numbers and less on numbers less than 1.
fn erf(&self) -> Decimal
[src]
Abramowitz Approximation of Error Function from wikipedia
fn norm_cdf(&self) -> Decimal
[src]
The Cumulative distribution function for a Normal distribution
fn norm_pdf(&self) -> Decimal
[src]
The Probability density function for a Normal distribution