function | since v1.11.50 | Edit |
(increment-exact a)
Returns a incremented by 1, throws ArithmeticException on overflow.
(defn ^number increment-exact
{:added "1.11.10"}
[a]
(if (or (>= a js/Number.MAX_SAFE_INTEGER) (< a js/Number.MIN_SAFE_INTEGER))
(throw (ex-info "Integer overflow" {:fn "increment-exact"}))
(inc a)))