Liking cljdoc? Tell your friends :D

com.fulcrologic.rad.type-support.decimal

Support for CLJC arbitrary precision decimal numerics. CLJ support for BigDecimal works well, but it is not directly supported in CLJS. Use the support in this ns when you need to write CLJC code that works the same in both.

You MUST include big.js as a js dependency for this to compile in CLJS.

Support for CLJC arbitrary precision decimal numerics. CLJ support for BigDecimal works well, but it is not
directly supported in CLJS.  Use the support in this ns when you need to write CLJC code that works the same
in both.

You MUST include big.js as a js dependency for this to compile in CLJS.
raw docstring

*clj/s

(*)
(* & numbers)

Multiply the given numbers, using bigdecimal math

Multiply the given numbers, using bigdecimal math
sourceraw docstring

*default-rounding-mode*clj/s

source

*precision*clj/s

source

*primitive*clj/s

source

+clj/s

(+)
(+ & numbers)

Add the given numbers together, coercing any that are not numeric.

Add the given numbers together, coercing any that are not numeric.
sourceraw docstring

-clj/s

(- & numbers)

Subtract the given numbers, using bigdecimal math

Subtract the given numbers, using bigdecimal math
sourceraw docstring

<clj/s

source

<=clj/s

source

=clj/s

source

>clj/s

source

>=clj/s

source

big->bigdecclj/s

(big->bigdec n)

Convert a low-level js Big number into a bigdecimal. No-op in CLJ.

WARNING: This is a low-level operation that should only be used if implementing your own extended functions for math.

Convert a low-level js Big number into a bigdecimal. No-op in CLJ.

WARNING: This is a low-level operation that should only be used if implementing your own extended functions for
math.
sourceraw docstring

bigdecimal?clj/s

(bigdecimal? v)
source

coerce-to-primitiveclj/s

(coerce-to-primitive n)

Coerce a number from a big rep to a floating point one. This is lossy.

Coerce a number from a big rep to a floating point one. This is lossy.
sourceraw docstring

compare-fnclj/s≠

clj
(compare-fn core-fn)
cljs
(compare-fn big-fn)
source

divclj/s

(div n d)
(div n d precision)

Divide the given two numbers, using bigdecimal math, with 20 digits of precision. In primitive mode just uses regular /.

Divide the given two numbers, using bigdecimal math, with 20 digits
of precision. In primitive mode just uses regular `/`.
sourceraw docstring

floorclj/s

(floor n)

Returns the floor of n, which is n with all decimal digits removed.

Returns the floor of n, which is n with all decimal digits removed.
sourceraw docstring

maxclj/s

(max number & numbers)
source

minclj/s

(min number & numbers)
source

n->bigclj/s

(n->big n)

Convert a number-like thing into a low-level js Big representation.

WARNING: This is a low-level operation that should only be used if implementing your own extended functions for math.

Convert a number-like thing into a low-level js Big representation.

WARNING: This is a low-level operation that should only be used if implementing your own extended functions for
math.
sourceraw docstring

negativeclj/s

(negative n)

If n is positive then returns n*(-1) else returns n.

If n is positive then returns n*(-1) else returns n.
sourceraw docstring

negative?clj/s

(negative? v)

Predicate for clj(s) negative bigdecimal

Predicate for clj(s) negative bigdecimal
sourceraw docstring

numericclj/s

(numeric s)

Coerce to a numeric from an arbitrary type (number, string, or numeric).

Coerce to a numeric from an arbitrary type (number, string, or numeric).
sourceraw docstring

numeric->currency-strclj/s

(numeric->currency-str n)
(numeric->currency-str n language country currency-code)

DEPRECATED: Use fulcro i18n support with something like js/Intl instead. js-joda locales are no longer the way to go, and this is not really a concern of numerics themselves.

Convert a numeric into a locale-specific currency string. The defaults are en, US, and USD.

DEPRECATED: Use fulcro i18n support with something like js/Intl instead. js-joda locales are no longer the way to go,
and this is not really a concern of numerics themselves.

Convert a numeric into a locale-specific currency string. The defaults are `en`, `US`, and `USD`.
sourceraw docstring

numeric->doubleclj/s

(numeric->double n)
source

numeric->percent-strclj/s

(numeric->percent-str n)

DEPRECATED: Use localization functions from i18n or js/Intl. This functions should never have been added here.

DEPRECATED: Use localization functions from i18n or js/Intl. This functions should never have been added here.
sourceraw docstring

numeric->strclj/s

(numeric->str bd)

Convert a math number to a string.

Convert a math number to a string.
sourceraw docstring

numeric?clj/s

(numeric? v)

Predicate for clj(s) dynamic number (n or bigdecimal). Returns true if the given value is a numeric in the current computing context (primitive or BigDecimal).

Predicate for clj(s) dynamic number (n or bigdecimal). Returns true if the given value is a numeric
in the current computing context (primitive or BigDecimal).
sourceraw docstring

positiveclj/s

(positive n)

If n is negative then returns n*(-1) else returns n.

If n is negative then returns n*(-1) else returns n.
sourceraw docstring

positive?clj/s

(positive? v)

Predicate for clj(s) positive bigdecimal

Predicate for clj(s) positive bigdecimal
sourceraw docstring

roundclj/s

(round n decimal-digits)
(round n decimal-digits rounding-mode)

Round the given number to the given number of decimal digits. Returns a new bigdecimal number. The rounding mode default to :half-up, but can also be :up, :down, or :half-even. You can change the default rounding mode via the dynamic var default-rounding-mode.

n can be nil (returns 0), a numeric string, a regular number, or a bigdecimal.

Round the given number to the given number of
decimal digits. Returns a new bigdecimal number. The rounding mode default to :half-up, but can also
be :up, :down, or :half-even.  You can change the default rounding mode via the dynamic var *default-rounding-mode*.

n can be nil (returns 0), a numeric string, a regular number, or a bigdecimal.
sourceraw docstring

rounding-modesclj/s

source

strip-zeroesclj/s

(strip-zeroes s)
source

with-primitive-opsclj/smacro

(with-primitive-ops & body)

Creates a thread-safe dynamic context where the math operations from this namespace use primitives instead of BigDecimal for speed.

Creates a thread-safe dynamic context where the math operations from this namespace
use primitives instead of BigDecimal for speed.
sourceraw docstring

zeroclj/s

(zero)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close