Trait rust_decimal::MathematicalOps [−][src]
pub trait MathematicalOps {}Show methods
fn exp(&self) -> Decimal; fn checked_exp(&self) -> Option<Decimal>; fn exp_with_tolerance(&self, tolerance: Decimal) -> Decimal; fn checked_exp_with_tolerance(&self, tolerance: Decimal) -> Option<Decimal>; fn powi(&self, exp: i64) -> Decimal; fn checked_powi(&self, exp: i64) -> Option<Decimal>; fn powu(&self, exp: u64) -> Decimal; fn checked_powu(&self, exp: u64) -> Option<Decimal>; fn powf(&self, exp: f64) -> Decimal; fn checked_powf(&self, exp: f64) -> Option<Decimal>; fn powd(&self, exp: Decimal) -> Decimal; fn checked_powd(&self, exp: Decimal) -> 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; fn checked_norm_pdf(&self) -> Option<Decimal>;
Expand description
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
The estimated exponential function, ex. Stops calculating when it is within
tolerance of roughly 0.0000002
.
fn checked_exp(&self) -> Option<Decimal>
fn checked_exp(&self) -> Option<Decimal>
The estimated exponential function, ex. Stops calculating when it is within
tolerance of roughly 0.0000002
. Returns None
on overflow.
fn exp_with_tolerance(&self, tolerance: Decimal) -> Decimal
fn exp_with_tolerance(&self, tolerance: Decimal) -> Decimal
The estimated exponential function, ex using the tolerance
provided as a hint
as to when to stop calculating. A larger tolerance will cause the number to stop calculating
sooner at the potential cost of a slightly less accurate result.
fn checked_exp_with_tolerance(&self, tolerance: Decimal) -> Option<Decimal>
fn checked_exp_with_tolerance(&self, tolerance: Decimal) -> Option<Decimal>
The estimated exponential function, ex using the tolerance
provided as a hint
as to when to stop calculating. A larger tolerance will cause the number to stop calculating
sooner at the potential cost of a slightly less accurate result.
Returns None
on overflow.
fn checked_powi(&self, exp: i64) -> Option<Decimal>
fn checked_powi(&self, exp: i64) -> Option<Decimal>
Raise self to the given integer exponent xy returning None
on overflow.
fn checked_powu(&self, exp: u64) -> Option<Decimal>
fn checked_powu(&self, exp: u64) -> Option<Decimal>
Raise self to the given unsigned integer exponent xy returning None
on overflow.
fn checked_powf(&self, exp: f64) -> Option<Decimal>
fn checked_powf(&self, exp: f64) -> Option<Decimal>
Raise self to the given floating point exponent xy returning None
on overflow.
Raise self to the given Decimal exponent: xy. If exp
is not whole then the approximation
ey*ln(x) is used.
fn checked_powd(&self, exp: Decimal) -> Option<Decimal>
fn checked_powd(&self, exp: Decimal) -> Option<Decimal>
Raise self to the given Decimal exponent xy returning None
on overflow.
If exp
is not whole then the approximation ey*ln(x) is used.
The square root of a Decimal. Uses a standard Babylonian method.
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 checked_norm_pdf(&self) -> Option<Decimal>
fn checked_norm_pdf(&self) -> Option<Decimal>
The Probability density function for a Normal distribution returning None
on overflow.