function | since v0.0-927 | clojure.core/mod | Edit |
(mod n d)
Returns the modulus of dividing numerator n
by denominator d
.
Returns NaN
when d
is 0 (divide by 0 error).
Truncates toward negative infinity.
(mod -5 3)
;;=> 1
(mod 5 3)
;;=> 2
(mod 5 0)
;;=> NaN
Modulus of num and div. Truncates toward negative infinity.
(defn mod
[n d]
(js-mod (+ (js-mod n d) d) d))