remainder (%)
remainder `r = a % b`, `r` has the same sign as `a`.
Last updated
Was this helpful?
remainder `r = a % b`, `r` has the same sign as `a`.
Last updated
Was this helpful?
JS ⟩ operator ⟩ arithmetic ⟩ remainder (%)
a
%
b
returns
a
, if a
= ±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.