On May 19, 2014, at 2:17 PM, Greg D <gregoire.da...@gmail.com> wrote:

> user> (unchecked-add ^Long(Long/MAX_VALUE) ^Long(Long/MAX_VALUE) )
> ArithmeticException integer overflow  clojure.lang.Numbers.throwIntOverflow 
> (Numbers.java:1424)

The docs for unchecked-add 
(http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/unchecked-add)
 only cover the case of both arguments being primitive longs. Calling with 
other argument types invokes behavior that is not currently documented. That 
may be intentional to allow the behavior to change in the future, or it may be 
an oversight in which case the docs could be improved to document the intended 
behavior for more argument types.

Regarding the current implementation, there is code to handle the case of 
calling unchecked-add with two Long arguments. In that case, unchecked_add 
behaves the same way as + does and throws the overflow exception.

--Steve

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to