user=> (- Integer/MAX_VALUE Integer/MIN_VALUE)
java.lang.ArithmeticException: integer overflow (NO_SOURCE_FILE:0)
user=> (- Long/MAX_VALUE Long/MIN_VALUE)
java.lang.ArithmeticException: integer overflow (NO_SOURCE_FILE:0)

Is this behavior correct?

Frantisek


On Jan 10, 5:25 am, Chouser <chou...@gmail.com> wrote:
> On Thu, Jan 8, 2009 at 2:07 PM, Achim Passen <achim.pas...@gmail.com> wrote:
>
> > Hi all!
>
> > I encountered some corner cases where overflow checking for "-"
> > doesn't work as I would expect:
>
> > user=> (- Integer/MAX_VALUE Integer/MIN_VALUE)
> > -1
> > user=> (- Long/MAX_VALUE Long/MIN_VALUE)
> > -1
>
> > The problem seems to be that negating MIN_VALUE yields MIN_VALUE
> > again, so it slips through the overflow check (see below).
>
> > Shall I add that to the issues list?
>
> I think you should go ahead.  I don't see how this could not be a bug.
>
> --Chouser
--~--~---------~--~----~------------~-------~--~----~
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
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