Returns the division of x by y, both int or long.
Note - uses a primitive operator subject to truncation.
;; demonstrate that you can use the standard divide function "/" to ;; calculate 1 trillion divided by 10 but that unchecked-divide throws an error user=> (def thous 1000) #'user/thous user=> (def trill (* thous thous thous thous)) #'user/trill user=> (unchecked-divide trill 10) java.lang.IllegalArgumentException: No matching method found: unchecked_divide (NO_SOURCE_FILE:0) user=> (/ trill 10) 100000000000 user=>
(defn unchecked-divide
"Returns the 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_divide ~x ~y)))
:added "1.0"}
[x y] (. clojure.lang.Numbers (unchecked_divide x y)))
Comments top
No comments for unchecked-divide. Log in to add a comment.