โremainder (%)
remainder `r = a % b`, `r` has the same sign as `a`.
Last updated
remainder `r = a % b`, `r` has the same sign as `a`.
Last updated
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.