RosettaCodeData/Task/Integer-overflow/Clojure/integer-overflow-2.clj

9 lines
464 B
Clojure

(set! *unchecked-math* true)
(* -1 (dec -9223372036854775807)) ;=> -9223372036854775808
(+ 5000000000000000000 5000000000000000000) ;=> -8446744073709551616
(- -9223372036854775807 9223372036854775807) ;=> 2
(* 3037000500 3037000500) ;=> -9223372036709301616
; Note: The following division will currently silently overflow regardless of *unchecked-math*
; See: http://dev.clojure.org/jira/browse/CLJ-1253
(/ (dec -9223372036854775807) -1) ;=> -9223372036854775808