function | since v1.11.50 | Edit |
(negate-exact a)
Returns the negation of a, throws ArithmeticException on overflow.
(defn ^number negate-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 "negate-exact"}))
(- a)))