ClojureDocs

Nav

Namespaces

unchecked-multiply

clojure.core

Available since 1.0 (source)
  • (unchecked-multiply x y)
Returns the product of x and y, both long.
Note - uses a primitive operator subject to overflow.
1 Example
;; the unchecked-multiply function silently overflows

user=> (* 1000000000000 10)
10000000000000
user=> (unchecked-multiply 1000000000000 10)
10000000000000

user=> (* 3037000500 3037000500)
ArithmeticException integer overflow  clojure.lang.Numbers.throwIntOverflow (Numbers.java:1424)
user=> (unchecked-multiply 3037000500 3037000500)
-9223372036709301616

See Also

Returns the product of nums. (*) returns 1. Does not auto-promote longs, will throw on overflow. S...

Added by Dimagog

Returns the product of nums. (*') returns 1. Supports arbitrary precision. See also: *

Added by Dimagog
0 Notes
No notes for unchecked-multiply