Back
increment-exact (clj)
(source)function
(increment-exact a)
Returns a incremented by 1, throws ArithmeticException on overflow.
See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#incrementExact-long-
Examples
clojure
(ns clojure.test-clojure.math
(:require
[clojure.test :refer :all]
[clojure.math :as m]))
(deftest test-increment-exact
(try
(m/increment-exact Long/MAX_VALUE)
(is false)
(catch ArithmeticException _
(is true))))