List.sortBy shows wrong result

Chris <[email protected]> Wed, 24 Feb 2016 23:56:04 -0800 (PST)
Newsgroups gmane.comp.lang.scala
Message-ID <[email protected]>
Hi all,


List.sortBy show a strange behaviour:

val l = List(Int.MinValue, Int.MinValue+1)
l.sortBy(I => I)  // List(-2147483648, -2147483647)
l.sortBy(I => -I) // List(-2147483648, -2147483647)


If I use other values anything seems ok

val l = List(Int.MinValue+2, Int.MinValue+1)
l.sortBy(I => I)  // List(-2147483647, -2147483646)
l.sortBy(I => -I) // List(-2147483646, -2147483647)


What's wrong here?
Can anyone help? Thanks in advance.

Chris


-- 
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.