user=> (mod 10 5) 0 user=> (mod 10 6) 4 user=> (mod 10 10) 0 user=> (mod 10 -1) 0
remainder of dividing numerator by denominator.
(defn mod "Modulus of num and div. Truncates toward negative infinity." {:added "1.0" :static true} [num div] (let [m (rem num div)] (if (or (zero? m) (= (pos? num) (pos? div))) m (+ m div))))
Comments top
No comments for mod. Log in to add a comment.