On Fri, Aug 14, 2009 at 5:58 AM, Mike Hinchey<hinche...@gmail.com> wrote:
> The difference is MAX_VALUE is a primitive int, but 1 (any literal) is an
> Integer.
>
> user> Integer/MAX_VALUE
> 2147483647
> user> (inc 2147483647)
> 2147483648
>
> But, I agree there is inconsistency. They should all check, except for the
> unchecked-* fns.
>
> user> (* Double/MAX_VALUE Double/MAX_VALUE)
> Infinity
> user> (* Integer/MAX_VALUE Integer/MAX_VALUE)
> #<CompilerException java.lang.ArithmeticException: integer overflow
> (NO_SOURCE_FILE:0)>
>
> Since multiple for long and int checks for overflow, shouldn't multiple for
> double and float check for Infinity?

No. Infinity is a possible and detectable value of floats. Anyone
using floats has to potentially deal with it. Integer wrap produces
undetectably bad integers, thus the check.

Rich

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