Expand description
Core utilities for handling decimal numbers in financial calculations.
Constants§
- DIV_
DEFAULT_ SCALE - Scale applied to banker’s-rounding divisions in
d_div. - ONE_DAY
- Represents the daily interest rate factor used for financial calculations, approximately equivalent to 1/252 (a standard value for the number of trading days in a year).
Traits§
- Decimal
Stats - Defines statistical operations for collections of decimal values.
Functions§
- d_add
- Checked
Decimaladdition with operand-preserving overflow reporting. - d_div
- Checked
Decimaldivision with banker’s rounding at scale 28. - d_exp
- Checked
e^xwith underflow flushed to zero. - d_
exp_ f64 - Exponential evaluated in
f64, for the per-step walk kernels (#860). - d_ln
- Checked natural logarithm.
- d_
ln_ f64 - Natural logarithm evaluated in
f64, for the numeric kernels (#857). - d_mul
- Checked
Decimalmultiplication with operand-preserving overflow reporting. - d_powd
- Checked
base^exponent. - d_
product_ iter - Checked product over any
IntoIteratorofDecimalvalues. - d_sqrt
- Checked square root.
- d_
sqrt_ f64 - Square root evaluated in
f64, for the per-step walk kernels (#860). - d_sub
- Checked
Decimalsubtraction with operand-preserving overflow reporting. - d_sum
- Checked sum over a slice of
Decimalvalues. - d_
sum_ iter - Checked sum over any
IntoIteratorofDecimalvalues. - decimal_
normal_ sample - Draws a standard normal sample from the thread-local RNG, as a
Decimal. - decimal_
normal_ sample_ with - Draws a standard normal sample from
rng, as aDecimal. - decimal_
to_ f64 - Converts a
Decimalto thef64nearest to it (ties to even). - decimal_
uniform_ sample_ with - Draws a uniform sample on
[0, 1)fromrng, as aDecimal. - f64_
to_ decimal - Converts an f64 floating-point number to a Decimal.
- finite_
decimal - Attempts to convert a finite
f64into aDecimal. - p_sqrt
- Checked square root of a
Positive, routed throughd_sqrtso that no production path reaches the panicking upstreamsqrtthatPositive::checked_sqrtstill wraps (#588).