The sign of the remainder that is returned by a % operator matches the sign of the dividend. Therefore
-7 % 5 = -2
7 % -5 = 2
and the first inequality will return false.
Ceil() method rounds its argument up. Therefore
Math.ceil(-2.5) = -2, Math.abs(-2) = 2
Math.abs(-2.5) = 2.5, Math.ceil(2.5) = 3
and the second inequality returns true.
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать