Liking cljdoc? Tell your friends :D

io.randomseed.bankster.scale


*each*clj

Enables re-scaling after each consecutive operation.

Enables re-scaling after each consecutive operation.
sourceraw docstring

*rounding-mode*clj

Default rounding mode.

Default rounding mode.
sourceraw docstring

->doubleclj

(->double n)
(->double n scale)
(->double n rounding-mode)
(->double n scale rounding-mode)

Converts to a double with optional rescaling and rounding. If the precision of double is to small to express the value, rounding must be provided (either explicitly or using rounding-mode), otherwise an exception will be thrown.

Converts to a double with optional rescaling and rounding. If the precision of
double is to small to express the value, rounding must be provided (either
explicitly or using *rounding-mode*), otherwise an exception will be thrown.
sourceraw docstring

->floatclj

(->float n)
(->float n scale)
(->float n rounding-mode)
(->float n scale rounding-mode)

Converts to a float with optional rescaling and rounding. If the precision of float is to small to express the value, rounding must be provided (either explicitly or using rounding-mode), otherwise an exception will be thrown.

Converts to a float with optional rescaling and rounding. If the precision of
float is to small to express the value, rounding must be provided (either
explicitly or using *rounding-mode*), otherwise an exception will be thrown.
sourceraw docstring

->intclj

(->int n)
(->int n rounding-mode)

Converts to an int with optional rounding.

Converts to an int with optional rounding.
sourceraw docstring

->longclj

(->long n)
(->long n rounding-mode)

Converts to a long with optional rounding.

Converts to a long with optional rounding.
sourceraw docstring

div-math-contextclj

(div-math-context a b)
(div-math-context a b rounding-mode)

Returns the MathContext set to handle the possible precision for the operation of dividing two BigDecimal numbers. Optional rounding mode may be provided.

Returns the MathContext set to handle the possible precision for the operation of
dividing two BigDecimal numbers. Optional rounding mode may be provided.
sourceraw docstring

div-max-precisionclj

(div-max-precision a b)

Returns the maximum possible precision for the operation of dividing two BigDecimal numbers.

Returns the maximum possible precision for the operation of dividing two BigDecimal
numbers.
sourceraw docstring

eachcljmacro

(each & body)

Enables re-scaling on some consecutive operations which support it and sets the rounding mode for operations on scaled values. Internally sets rescale-each to true and rounding-mode to the given value.

Practically, in most cases it is better to use the with-rescaling macro which also sets rounding mode.

Enables re-scaling on some consecutive operations which support it and sets the rounding mode for
operations on scaled values. Internally sets *rescale-each* to true and
*rounding-mode* to the given value.

Practically, in most cases it is better to use the with-rescaling macro which also
sets rounding mode.
sourceraw docstring

fractionalclj

(fractional n)
(fractional n scale)
(fractional n scale rounding-mode)

Returns the fractional part of the given number, converted to decimal if required. Optional scale and rounding mode can be given. Makes use of rounding-mode if it's set.

Returns the fractional part of the given number, converted to decimal if
required. Optional scale and rounding mode can be given. Makes use of
*rounding-mode* if it's set.
sourceraw docstring

integerclj

(integer n)
(integer n scale)
(integer n scale rounding-mode)

Returns the integer part of the given number, converted to decimal if required. Optional scale and rounding mode can be given. Makes use of rounding-mode if it's set.

Returns the integer part of the given number, converted to decimal if
required. Optional scale and rounding mode can be given. Makes use of
*rounding-mode* if it's set.
sourceraw docstring

ROUND_CEILINGclj

Rounding mode to round towards positive infinity.

Rounding mode to round towards positive infinity.
sourceraw docstring

ROUND_DOWNclj

Rounding mode to round towards zero.

Rounding mode to round towards zero.
sourceraw docstring

ROUND_FLOORclj

Rounding mode to round towards negative infinity.

Rounding mode to round towards negative infinity.
sourceraw docstring

ROUND_HALF_DOWNclj

Rounding mode to round towards nearest neighbor, unless neighbors are equidistant, in which case round down.

Rounding mode to round towards nearest neighbor, unless neighbors are equidistant,
in which case round down.
sourceraw docstring

ROUND_HALF_EVENclj

Rounding mode to round towards nearest neighbor, unless neighbors are equidistant, in which case round towards the nearest one.

Rounding mode to round towards nearest neighbor, unless neighbors are equidistant,
in which case round towards the nearest one.
sourceraw docstring

ROUND_HALF_UPclj

Rounding mode to round towards nearest neighbor, unless neighbors are equidistant, in which case round up.

Rounding mode to round towards nearest neighbor, unless neighbors are equidistant,
in which case round up.
sourceraw docstring

ROUND_UNNECESSARYclj

Indication that no rounding is necessary.

Indication that no rounding is necessary.
sourceraw docstring

ROUND_UPclj

Rounding mode to round away from zero.

Rounding mode to round away from zero.
sourceraw docstring

Scalablecljprotocol

The Scalable protocol describes values that can be scaled.

The Scalable protocol describes values that can be scaled.

amountclj

(amount num)
(amount num scale)
(amount num scale rounding-mode)

Returns the amount of a scalable as a BigDecimal number. Some scalables may not be purely numeric so this function is to get the actual, calculable value out of them.

Returns the amount of a scalable as a BigDecimal number. Some scalables may not
be purely numeric so this function is to get the actual, calculable value out of
them.

applied?clj

(applied? num)

Returns true if the value is of type which contains scaling information.

Returns true if the value is of type which contains scaling information.

applyclj

(apply num)
(apply num scale)
(apply num scale rounding-mode)

Converts the given value to a scalable with or without changing its scale. For values that already are scalable it changes their scales if called with a second argument. The third argument, rounding-mode, must be present when downscaling and rounding is needed. For compound values (like monetary amounts) it will rescale the amount but will NOT update scale information of the unit (e.g. currency component).

When operating on Money objects and called with a single argument, it reapplies the nominal currency scale.

Converts the given value to a scalable with or without changing its scale. For
values that already are scalable it changes their scales if called with a second
argument. The third argument, rounding-mode, must be present when downscaling and
rounding is needed. For compound values (like monetary amounts) it will rescale the
amount but will NOT update scale information of the unit (e.g. currency component).

When operating on Money objects and called with a single argument, it reapplies
the nominal currency scale.

ofclj

(of num)

Returns a scale. If the given value is not of type that scales (or is used to produce scaled types) it will be converted to such.

Returns a scale. If the given value is not of type that scales (or is used to
produce scaled types) it will be converted to such.

scalable?clj

(scalable? num)

Returns true if the value can be converted to a scalable.

Returns true if the value can be converted to a scalable.
sourceraw docstring

to-clojure-stringclj

(to-clojure-string n)

Converts big decimal to a plain string, adding the M suffix when needed.

Converts big decimal to a plain string, adding the M suffix when needed.
sourceraw docstring

to-clojure-symbolclj

(to-clojure-symbol n)

Converts big decimal to a symbol, adding the M suffix when needed.

Converts big decimal to a symbol, adding the M suffix when needed.
sourceraw docstring

to-plain-stringclj

(to-plain-string n)

Converts big decimal to a plain string.

Converts big decimal to a plain string.
sourceraw docstring

to-symbolclj

(to-symbol n)

Converts big decimal to a symbol.

Converts big decimal to a symbol.
sourceraw docstring

unscaled-contextclj

MathContext indicating auto-scaling and no rounding.

MathContext indicating auto-scaling and no rounding.
sourceraw docstring

withclj

(with num)
(with num scale)
(with num scale rounding-mode)

Alias for scale/apply.

Alias for scale/apply.
sourceraw docstring

with-rescalingcljmacro

(with-rescaling rounding-mode & body)

Enables re-scaling on some consecutive operations which support it and sets the rounding mode for operations on scaled values. Internally sets *each* to true and *rounding-mode* to the given value.

The first argument should be a valid rounding (from io.randomseed.bankster.scale or java.math.RoundingMode) or one of the following:

CEILING - rounds towards positive infinity. DOWN - rounds towards zero. FLOOR - rounds towards negative infinity. HALF_DOWN - rounds towards nearest neighbor unless both neighbors are equidistant, in which case rounds down. HALF_EVEN - rounds towards the nearest neighbor unless both neighbors are equidistant, and if so, rounds towards the even. HALF_UP - rounds towards the nearest neighbor unless both neighbors are equidistant, and if so, rounds up. UP – rounds away from zero UNNECESSARY - asserts that the requested operation has an exact result, hence no rounding is necessary.

Enables re-scaling on some consecutive operations which support it and sets the
rounding mode for operations on scaled values. Internally sets `*each*` to true and
`*rounding-mode*` to the given value.

The first argument should be a valid rounding (from `io.randomseed.bankster.scale`
or `java.math.RoundingMode`) or one of the following:

CEILING     - rounds towards positive infinity.
DOWN        - rounds towards zero.
FLOOR       - rounds towards negative infinity.
HALF_DOWN   - rounds towards nearest neighbor unless both neighbors are equidistant, in which case rounds down.
HALF_EVEN   - rounds towards the nearest neighbor unless both neighbors are equidistant, and if so, rounds towards the even.
HALF_UP     - rounds towards the nearest neighbor unless both neighbors are equidistant, and if so, rounds up.
UP          – rounds away from zero
UNNECESSARY - asserts that the requested operation has an exact result, hence no rounding is necessary.
sourceraw docstring

with-roundingcljmacro

(with-rounding rounding-mode & body)

Sets the rounding mode for operations on scaled values.

The first argument should be a valid rounding (from io.randomseed.bankster.scale or java.math.RoundingMode) or one of the following:

CEILING - rounds towards positive infinity. DOWN - rounds towards zero. FLOOR - rounds towards negative infinity. HALF_DOWN - rounds towards nearest neighbor unless both neighbors are equidistant, in which case rounds down. HALF_EVEN - rounds towards the nearest neighbor unless both neighbors are equidistant, and if so, rounds towards the even. HALF_UP - rounds towards the nearest neighbor unless both neighbors are equidistant, and if so, rounds up. UP – rounds away from zero UNNECESSARY - asserts that the requested operation has an exact result, hence no rounding is necessary.

Sets the rounding mode for operations on scaled values.

The first argument should be a valid rounding (from `io.randomseed.bankster.scale`
or `java.math.RoundingMode`) or one of the following:

CEILING     - rounds towards positive infinity.
DOWN        - rounds towards zero.
FLOOR       - rounds towards negative infinity.
HALF_DOWN   - rounds towards nearest neighbor unless both neighbors are equidistant, in which case rounds down.
HALF_EVEN   - rounds towards the nearest neighbor unless both neighbors are equidistant, and if so, rounds towards the even.
HALF_UP     - rounds towards the nearest neighbor unless both neighbors are equidistant, and if so, rounds up.
UP          – rounds away from zero
UNNECESSARY - asserts that the requested operation has an exact result, hence no rounding is necessary.
sourceraw docstring

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

× close