Because the literal is readed as BigInt:
user=> (class 6546546546546546546850348954895480584039545804 )
clojure.lang.BigInt
2015-09-04 22:48 GMT+08:00 Ali M :
> why?
>
>
> user=> (+ 6546546546546546546850348954895480584039545804
>
why?
user=> (+ 6546546546546546546850348954895480584039545804
7548979534287548957345843954749357348757897)
6554095526080834095807694798850229941388303701N
user=> (+ Long/MAX_VALUE Long/MAX_VALUE)
ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow
(Numbers.java:1501)
Ok, so to give myself a safe and consistent way to reason about this
the addition operator, and probably other arithmetic operator
dont promote ouput
so long+ long = long or exception
long + bigint = bigint
if i need outpout promition i can use +'
hmmm, a bit tricky
On Friday, September 4,
You can use *unchecked-math* if you want unchecked arithmetic behaviour:
=> (set! *unchecked-math* true)
true
=> (+ Long/MAX_VALUE Long/MAX_VALUE)
-2
On Friday, 4 September 2015 23:04:27 UTC+8, Ali M wrote:
>
> Ok, so to give myself a safe and consistent way to reason about this
> the addition