Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by sciSpider Java v3.0

...

  • The sign of the remainder is always the same as that of the dividend. For example, -3 % -2 will result in the value -1. Thus As a result its behavior can sometimes be deceptive.

...

A related pitfall is the use of the Math.abs method that takes an integer as a parameter and returns its absolute value. Due to the asymmetry between the representation of negative and positive integer values (there is an extra minimum negative value), there is no equivalent positive value for Integer.MIN_VALUE. ThusAs a result, Math.abs(Integer.MIN_VALUE) always returns a non positive Integer.MIN_VALUE.

...