pub trait MathematicalOps {
Show 27 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 checked_ln(&self) -> Option<Decimal>; fn log10(&self) -> Decimal; fn checked_log10(&self) -> Option<Decimal>; fn erf(&self) -> Decimal; fn norm_cdf(&self) -> Decimal; fn norm_pdf(&self) -> Decimal; fn checked_norm_pdf(&self) -> Option<Decimal>; fn sin(&self) -> Decimal; fn checked_sin(&self) -> Option<Decimal>; fn cos(&self) -> Decimal; fn checked_cos(&self) -> Option<Decimal>; fn tan(&self) -> Decimal; fn checked_tan(&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.

The estimated exponential function, ex. Stops calculating when it is within tolerance of roughly 0.0000002. Returns None on overflow.

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.

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.

Raise self to the given integer exponent: xy

Raise self to the given integer exponent xy returning None on overflow.

Raise self to the given unsigned integer exponent: xy

Raise self to the given unsigned integer exponent xy returning None on overflow.

Raise self to the given floating point exponent: xy

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.

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.

Calculates the natural logarithm for a Decimal calculated using Taylor’s series.

Calculates the checked natural logarithm for a Decimal calculated using Taylor’s series. Returns None for negative numbers or zero.

Calculates the base 10 logarithm of a specified Decimal number.

Calculates the checked base 10 logarithm of a specified Decimal number. Returns None for negative numbers or zero.

Abramowitz Approximation of Error Function from wikipedia

The Cumulative distribution function for a Normal distribution

The Probability density function for a Normal distribution.

The Probability density function for a Normal distribution returning None on overflow.

Computes the sine of a number (in radians). Panics upon overflow.

Computes the checked sine of a number (in radians).

Computes the cosine of a number (in radians). Panics upon overflow.

Computes the checked cosine of a number (in radians).

Computes the tangent of a number (in radians). Panics upon overflow or upon approaching a limit.

Computes the checked tangent of a number (in radians). Returns None on limit.

Implementors