+ 2
Java question
Why is Integer.min_value - integer.max_value /2= 0?
7 Answers
+ 2
Try this
System.out.print((double)(Integer.MIN_VALUE-Integer.MAX_VALUE)/2);
+ 4
Simply primitive datatypes will have weird behavior when their values cross the limits.
+ 3
I assume it's because crossed the integer minimum size limit.
Smallest possible primitive integer in Java is -2^31, and biggest possible primitive integer in Java is 2^31-1.
-2^31 - 2^31-1 = -2^32-1
-2^32-1 < -2^31
+ 2
~ swim ~ yes that's right đ,I thought he might of been looking for somthing diffrent becuase 0 is the correct answer... who knows đ
+ 1
~ swim ~ I got the value 0.5 but was converted to int 0 so I needed to cast it back to double? also due to order of operation / has higher precedence then -