numbers v3.0.0 Numbers
Allows you to perform math on any kind of data structure that follows the Numeric behaviour.
This includes plain Integer and Floats, but also many custom numeric types specified in packages (such as Ratio, Decimal, Tensor, ComplexNum).
Summary
Functions
Computes the absolute value of num
Adds two Numeric a
and b
together
Divides the Numeric a
by b
Computes the unary minus of num
, also known as its negation
Multiplies the Numeric a
with the Numeric b
Power function: computes base^exponent
,
where base
is Numeric,
and exponent
has to be an integer
Subtracts the Numeric b
from the Numeric a
Tries to convert num
to a built-in floating-point number
Functions
Divides the Numeric a
by b
.
Note that this is a supposed to be a full (non-truncated) division; no rounding or truncation is supposed to happen, even when calculating with integers.
Power function: computes base^exponent
,
where base
is Numeric,
and exponent
has to be an integer.
This means that it is impossible to calculate roots by using this function.
If base
supports direct computation of pow
, that is used. Otherwise,
the Exponentiation by Squaring algorithm is used.