I am running Clojure 1.3.0 with La Clojure in IntelliJ IDEA while reading The Joy Of Clojure, and on section 4.1.3 (page 64), the authors demonstrate integer overflow with the following code:
(+ Integer/MAX_VALUE Integer/MAX_VALUE)
;=> java.lang.ArithmeticException: integer overflow
However, when I try it out on the REPL, I get instead
user=> (+ Integer/MAX_VALUE Integer/MAX_VALUE)
4294967294
user=> Integer/MAX_VALUE
2147483647
What is happening here? Why are my integers being added correctly instead of overflowing?
1.2.0
and get that exception. Seems like book [that edition] uses1.2.0
. And gertalot have the solution. – Chemulpo