Tidy Math API
add#
Adds two numbers together, returning undefined if either are nully. Optionally replaces nully values with 0.
Parameters#
a#
The first operand
b#
The second operand
nullyZero? = false#
If true, nully (null and undefined) values are replaced with 0 before performing the addition.
Usage#
rate#
Computes a rate (numerator / denominator), setting the value to 0 if denominator = 0 and numerator = 0. If denominator or numerator are nully, the result is undefined.
See also item::rate
Parameters#
numerator#
The value to use as numerator.
denominator#
The value to use as denominator.
allowDivideByZero?#
If true, evaluates division when denominator is 0 (typically resulting in Infinity), otherwise rates with 0 denominators are undefined.
Usage#
subtract#
Subtracts two numbers, returning undefined if either are nully. Optionally replaces nully values with 0.
Parameters#
a#
The first operand
b#
The second operand
nullyZero? = false#
If true, nully (null and undefined) values are replaced with 0 before performing the subtraction.