I try to do multiplication where overflowing is expected and the result
should be handled "modulo" ie the multiplication results in a truncated
long.

user> (unchecked-multiply (Long/MAX_VALUE) (Long/MAX_VALUE))
1 ;;is ok and expected

also

classificator.fnvhash> (unchecked-multiply Long/MAX_VALUE Long/MAX_VALUE)
1

(side note: what is different between Long/MAX_VALUE and the function call
(Long/MAX_VALUE)?)

BUT:

user> (def max1 Long/MAX_VALUE)
#'user/max1
user> (def max2 Long/MAX_VALUE)
#'user/max2
user> (unchecked-multiply max1 max2)

results in a "integer overflow". I have tried to type hinting and what not.
It seems like unchecked-multiply doesn't like vars, but thats surprising.
What am I doing wrong here?

I'm using Clojure 1.3.0.

/Linus

-- 
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

Reply via email to