You're viewing version 1.2.0 of unchecked-remainder. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

unchecked-remainder

clojure.core

  • (unchecked-remainder x y)
Returns the remainder of division of x by y, both int or long.
Note - uses a primitive operator subject to truncation.

1 Example top

  • user=> (unchecked-remainder 0 0)
    java.lang.ArithmeticException: / by zero (NO_SOURCE_FILE:0)
    
    user=> (unchecked-remainder Integer/MAX_VALUE Integer/MIN_VALUE)
    2147483647
    
    user=> (unchecked-remainder 0 Integer/MAX_VALUE)
    0
    
    user=> (unchecked-remainder 1 Integer/MAX_VALUE)
    1
    
    user=> (unchecked-remainder Integer/MAX_VALUE Integer/MAX_VALUE)
    0
    
    user=> (unchecked-remainder Integer/MIN_VALUE Integer/MAX_VALUE)
    -1
    
    user=> (unchecked-remainder -20  90)
    -20
    
    user=> (unchecked-remainder Integer/MAX_VALUE Long/MIN_VALUE)
    java.lang.IllegalArgumentException: No matching method found: unchecked_remainder (NO_SOURCE_FILE:0)
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:983 top

(defn unchecked-remainder
  "Returns the remainder of division of x by y, both int or long.
  Note - uses a primitive operator subject to truncation."
  {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_remainder ~x ~y)))
   :added "1.0"}
  [x y] (. clojure.lang.Numbers (unchecked_remainder x y)))
Vars in clojure.core/unchecked-remainder: defn
Used in 0 other vars

Comments top

No comments for unchecked-remainder. Log in to add a comment.