Skip to content

clojure.core/with-precision

View this page on ClojureDocs

Type: macro Added: Clojure 1.0 Examples: 3 Runnable: 0
([precision & exprs])

Sets the precision and rounding mode to be used for BigDecimal operations.

Usage: (with-precision 10 (/ 1M 3)) or: (with-precision 10 :rounding HALF_DOWN (/ 1M 3))

The rounding mode is one of CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP.

Examples

by Miles on . May have evaluation errors.
by freckletonj on . May have evaluation errors.
by tomdl89 on . May have evaluation errors.

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.