user=> (bigint 30) 30 ;; Actually do something BigInteger-ish... (http://download.oracle.com/javase/6/docs/api/) user=> (def x (bigint 97)) #'user/x user=> (.isProbablePrime x 1) true
(defn bigint
"Coerce to BigInteger"
{:tag BigInteger
:added "1.0"}
[x] (cond
(instance? BigInteger x) x
(decimal? x) (.toBigInteger ^BigDecimal x)
(ratio? x) (.bigIntegerValue ^clojure.lang.Ratio x)
(number? x) (BigInteger/valueOf (long x))
:else (BigInteger. x)))
Comments top
No comments for bigint. Log in to add a comment.