divide(): Quotients and Mathematical Division
divide() divides one value by another. For numbers, divide(12, 3) returns 4. It is useful when expressing rates, conversions, averages, proportions, and normalization in a readable function form.
Never ignore the denominator
Division by zero is undefined in ordinary real arithmetic. Test values with equal() or protect a model using and() before division. Very small denominators are also important because they can create huge, unstable values.
For matrices, divide has rules that differ from ordinary matrix multiplication; use dotDivide() when you explicitly need element-wise quotients. Pair division with multiply() to check a result, and apply round() only when presenting a value.
Units and precision
Division naturally changes units: kilometres divided by hours produces a speed. Keep units compatible and retain precision through intermediate calculations. For a collection’s average, combine sum() with its count deliberately.