Re:The compiler is always right
by rwallace on Sunday May 11, 2014 @11:56PM
(#7731151)
Well, not just kind of obvious why, but kind of obvious it's not a bug in Java! If you're dealing with quantities that don't fit in a 32-bit twos complement integer, you need to use a larger datatype.
Math.abs(-2147483647); // 2147483647
Math.abs(-2147483648); // -2147483648
When you know this behavior, it's kinda obvious why, but still...