➕remainder (%)
remainder `r = a % b`, `r` has the same sign as `a`.
JS ⟩ operator ⟩ arithmetic ⟩ remainder (%)
a
%
b
returns
a
, ifa
= ±0 /b
= ±Infinity.r
=
a
-
b
*
q
where:q
is the integer such that:r
has the same sign asa
, while being as close to 0 as possible.
⭐ remainder (%) and modulo are different❗ 👉 remainder vs. modulo vs. mod
% operator
works for floating-point numbers too.
Last updated