Precise math with an arbitrary precision.

Slower than normal math operations, but auto-promotes when needed.

Depending on the needs, there are several other namespaces with similar functionalities:

*

Available since version 1.0 (alias of clojure.core/*')

not referred automatically

Usage:
  • (*)

  • (* x)

  • (* x y)

  • (* x y & more)

Type signatures:
  • () → Number+

  • (Number+) → Number+

  • (Number+ ⨯ Number+) → Number+

  • (Number+ ⨯ Number+ ⨯ (Va Number+)) → Number+

Returns the product of nums. (*) returns 1. Supports arbitrary precision.

+

Available since version 1.0 (alias of clojure.core/+')

not referred automatically

Usage:
  • (+)

  • (+ x)

  • (+ x y)

  • (+ x y & more)

Type signatures:
  • () → Number+

  • (Number+) → Number+

  • (Number+ ⨯ Number+) → Number+

  • (Number+ ⨯ Number+ ⨯ (Va Number+)) → Number+

Returns the sum of nums. (+) returns 0. Supports arbitrary precision.

-

Available since version 1.0 (alias of clojure.core/-')

not referred automatically

Usage:
  • (- x)

  • (- x y)

  • (- x y & more)

Type signatures:
  • (Number+) → Number+

  • (Number+ ⨯ Number+) → Number+

  • (Number+ ⨯ Number+ ⨯ (Va Number+)) → Number+

If no ys are supplied, returns the negation of x, else subtracts the ys from x and returns the result. Supports arbitrary precision.

add

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (add x y)

Type signature:
  • (Number+ ⨯ Number+) → Number+

Returns the sum of x and y. Supports arbitrary precision.

dec

Available since version 1.0 (alias of clojure.core/dec')

not referred automatically

Usage:
  • (dec x)

Type signature:
  • (Number+) → Number+

Returns a number one less than x. Supports arbitrary precision.

inc

Available since version 1.0 (alias of clojure.core/inc')

not referred automatically

Usage:
  • (inc x)

Type signature:
  • (Number+) → Number+

Returns a number one greater than x. Supports arbitrary precision.

multiply

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (multiply x y)

Type signature:
  • (Number+ ⨯ Number+) → Number+

Returns the result of multiplication of x and y. Supports arbitrary precision.

negate

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (negate x)

Type signature:
  • (Number+) → Number+

Returns the negation of x. Supports arbitrary precision.

subtract

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (subtract x y)

Type signature:
  • (Number+ ⨯ Number+) → Number+

Returns the result of subtraction of y from x. Supports arbitrary precision.