unchecked-negate-int

clojure.core

  • (unchecked-negate-int x)
Returns the negation of x, an int.
Note - uses a primitive operator subject to overflow.

1 Example top

  • user=> (unchecked-negate-int 4)
    -4
    user=> (unchecked-negate-int 0)
    0
    user=> (unchecked-negate-int -7)
    7
    user=> (unchecked-negate-int Integer/MAX_VALUE)
    -2147483647
    user=> (unchecked-negate-int Integer/MIN_VALUE) ;overflow
    -2147483648
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:1112 top

(defn unchecked-negate-int
  "Returns the negation of x, an int.
  Note - uses a primitive operator subject to overflow."
  {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_int_negate ~x)))
   :added "1.0"}
  [x] (. clojure.lang.Numbers (unchecked_int_negate x)))
Vars in clojure.core/unchecked-negate-int:
Used in 0 other vars

Comments top

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