Numerical overflow matters when integer arithmetic crosses the range its type can represent. In Clojure, `+`, `-`, and `*` throw an `ArithmeticException` when a result with long operands exceeds the long range. Choose a different operator when a calculation must instead grow beyond that range or deliberately wrap around it. section 5.5 section 5.1
Three operator choices give different behavior:
- Use ordinary `+`, `-`, and `*` to detect long overflow with an exception. section 5.5
- Use primed operators such as `*'` when the result should promote to arbitrary precision rather than overflow. section 5.1 section 5.5
- Use `unchecked-add`, `unchecked-subtract`, `unchecked-multiply`, or their increment, decrement, and negate counterparts when overflow checks should be omitted. Addition, subtraction, and multiplication take exactly two arguments; the other three take one. section 5.13
Crossing the long boundary
`(unchecked-inc Long/MAX_VALUE)` yields `-9223372036854775808`, or `Long/MIN_VALUE`; `(unchecked-dec Long/MIN_VALUE)` yields `9223372036854775807`. The signed 64-bit value rolls from one end of its range to the other. section 5.13 section 5.1
(take 7 (iterate #(* % %) 2)) ; #1 ;; ArithmeticException integer overflow (take 7 (iterate #(*' % %) 2)) ;; (2 4 16 256 65536 4294967296 18446744073709551616N) ; #2
Repeated squaring makes the choice visible: ordinary `*` raises an overflow exception, while `*'` produces a larger integer. section 5.5
Wraparound can be intentional. A string-hashing example combines `unchecked-multiply` and `unchecked-add` to keep accumulating a bounded-width hash; a negative result is possible. Division is different: `/` can produce a ratio, and division by zero raises its own exception. section 5.13 section 5.5 section 5.1






