rem

added
1.0

ns
clojure.core

type
function

(rem num div)

remainder of dividing numerator by denominator.

                user=> (rem 10 9)
1
user=> (rem 2 2)
0
            
                ;; rem and mod are commonly used to get the remainder.
;; mod means Gaussian mod, so the result is always
;; non-negative.  Don't confuse it with ANSI C's %
;; operator, which despite being pronounced
;; 'mod' actually implements rem, i.e. -10 % 3 = -1.

user=> (mod -10 3)
2

user=> (rem -10 3)
-1