Number rounding approximates values to the finite precision available in a numerical representation. In Clojure, explicit precision matters when calculations use BigDecimal or when floating-point error can accumulate. section 5.11 section 5.13
Use with-precision to evaluate BigDecimal expressions with a chosen precision and rounding mode. Its contract accepts a nonnegative integer precision, an optional mode such as :rounding DOWN or HALF_EVEN, and one or more expressions. section 5.11
Controlling a non-terminating result
(/ 22M 7) raises an ArithmeticException because the decimal expansion does not terminate. (with-precision 4 (/ 22M 7)) returns 3.143M. A financial calculation can also promote inputs with bigdec, round a share quantity DOWN, and return a contractually chosen numeric type.
Practical considerations:
- BigDecimal values can spread through an expression, so boundary functions may promote inputs, calculate with explicit precision, and convert results according to their contract. section 5.11



