Returns the difference of x and y, both long.
Note - uses a primitive operator subject to overflow.
;; can't interchange INTs with LONGs, only F(int, int) or F(long, long) ;; F is a function, not an ;; overflow very easily as shown below. (unchecked-subtract Long/MIN_VALUE 5555555554) user=> 9223372031299220254 (unchecked-subtract Long/MIN_VALUE 1) user=> java.lang.IllegalArgumentException: No matching method found: unchecked_subtract (NO_SOURCE_FILE:0) (unchecked-subtract Long/MIN_VALUE Long/MIN_VALUE) user=> 0 (unchecked-subtract Integer/MIN_VALUE Long/MIN_VALUE) user=> java.lang.IllegalArgumentException: No matching method found: unchecked_subtract (NO_SOURCE_FILE:0) (unchecked-subtract Integer/MIN_VALUE Integer/MIN_VALUE) user=> 0 (unchecked-subtract Integer/MIN_VALUE 0) user=> -2147483648 (unchecked-subtract Integer/MIN_VALUE 1) user=> 2147483647 (unchecked-subtract Integer/MIN_VALUE 54444444) user=> 2093039204 (unchecked-subtract 123456 654321) user=> -530865
Returns the difference of x and y, both int or long. Note - uses a
Returns the product of x and y, both int or long. Note - uses a pri
Returns the remainder of division of x by y, both int or long. Note
(defn unchecked-subtract
"Returns the difference of x and y, both long.
Note - uses a primitive operator subject to overflow."
{:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_minus ~x ~y)))
:added "1.0"}
[x y] (. clojure.lang.Numbers (unchecked_minus x y)))
Comments top
No comments for unchecked-subtract. Log in to add a comment.