Tidy Math API
#
addAdds two numbers together, returning undefined
if either are nully. Optionally replaces nully values with 0.
#
Parametersa
#
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#
rateComputes 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
#
Parametersnumerator
#
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#
subtractSubtracts two numbers, returning undefined
if either are nully. Optionally replaces nully values with 0.
#
Parametersa
#
The first operand
b
#
The second operand
nullyZero? = false
#
If true, nully (null
and undefined
) values are replaced with 0 before performing the subtraction.