Enables re-scaling after each consecutive operation.
Enables re-scaling after each consecutive operation.
(->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.
(->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.
(->int n)
(->int n rounding-mode)
Converts to an int with optional rounding.
Converts to an int with optional rounding.
(->long n)
(->long n rounding-mode)
Converts to a long with optional rounding.
Converts to a long with optional rounding.
(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.
(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.
(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.
(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.
(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.
Rounding mode to round towards positive infinity.
Rounding mode to round towards positive infinity.
Rounding mode to round towards zero.
Rounding mode to round towards zero.
Rounding mode to round towards negative infinity.
Rounding mode to round towards negative infinity.
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.
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.
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.
Indication that no rounding is necessary.
Indication that no rounding is necessary.
Rounding mode to round away from zero.
Rounding mode to round away from zero.
The Scalable protocol describes values that can be scaled.
The Scalable protocol describes values that can be scaled.
(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? 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.
(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.
(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? num)
Returns true if the value can be converted to a scalable.
Returns true if the value can be converted to a scalable.
(to-clojure-string n)
Converts the amount to a plain string, adding the M suffix when needed.
Converts the amount to a plain string, adding the M suffix when needed.
(to-clojure-symbol n)
Converts the amount to a symbol, adding the M suffix when needed.
Converts the amount to a symbol, adding the M suffix when needed.
(to-plain-string n)
Converts the amount to a plain string.
Converts the amount to a plain string.
(to-symbol n)
Converts the amount to a symbol.
Converts the amount to a symbol.
MathContext indicating auto-scaling and no rounding.
MathContext indicating auto-scaling and no rounding.
(with num)
(with num scale)
(with num scale rounding-mode)
Alias for scale/apply.
Alias for scale/apply.
(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.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close