menu

manual-euclidean-remainder

Prefer remainderEuclidean over its manual double-remainder form

Applying remainder twice around an added positive divisor manually normalizes a negative remainder. Instead, you SHOULD call .remainderEuclidean() on the dividend.

Reported

1function wrap(value: int32): int32 {2    return ((value % 4) + 4) % 4;3}

Accepted

1function wrap(value: int32): int32 {2    return value.remainderEuclidean(4);3}