Expand description
Math and numeric helpers. Pan math and numeric helpers.
Structs§
- PanRng
- A small deterministic RNG (not cryptographically secure).
Functions§
- abs
- Returns the absolute value of
number. - add
- Adds two numbers. This will not match proper Pan math, which uses either ints/fixed point (I think both of those might wrap on overflow?) or floats (which I think are 32-bit).
- arccos
- Returns $\arccos(number)$ for inputs in $[-1, 1]$.
- arccosh
- Returns $\operatorname{arccosh}(number)$ for inputs $\ge 1$.
- arcsin
- Returns $\arcsin(number)$ for inputs in $[-1, 1]$.
- arcsinh
- Returns $\operatorname{arcsinh}(number)$.
- arctan
- Returns $\arctan(number)$.
- arctanh
- Returns $\operatorname{arctanh}(number)$ for inputs in $(-1, 1)$.
- cos
- Returns $\cos(number)$.
- cosh
- Returns $\cosh(number)$.
- div
- Divides
numeratorbydenominator. - divzero
- Divides, returning 0 when
denominatoris zero. - exp
- Returns $e^{number}$.
- fact
- Returns the factorial of
numberas an $f64$. - fact_
exact - Returns the factorial of
nas an exact big integer. - fix
- Truncates
numbertoward zero. - fixed
- In theory, convert to fixed point. At the moment this returns
numberunchanged. - float
- In theory, converts to floating point. At the moment this returns
numberunchanged. - fv
- Computes the future value for a payment stream.
- int
- Floors
numberto the nearest integer toward $-\infty$. - log
- Returns the natural logarithm of
number. - log10
- Returns the base-10 logarithm of
number. - max
- Returns the larger of
aandb. - min
- Returns the smaller of
aandb. - mul
- Multiplies two numbers.
- numsandwich
- Adds
extraunlessvalueis zero. - pmt
- Computes the payment for a loan or annuity.
- pv
- Computes the present value for a payment stream.
- round
- Rounds
numberto the nearest multiple ofstep. - sin
- Returns $\sin(number)$.
- sinh
- Returns $\sinh(number)$.
- sqr
- Returns $\sqrt{number}$ for non-negative inputs.
- sub
- Subtracts
denominatorfromnumerator. - tan
- Returns $\tan(number)$.
- tanh
- Returns $\tanh(number)$.
- zeroblank
- Returns
Nonewhennumberis zero, otherwiseSome(number).