Utils for the conversions and massaging of BigDecimal values.
Utils for the conversions and massaging of BigDecimal values.
(->decimal-conformer & {:keys [precision scale]})Returns a clojure.spec.alpha/conformer, that conforms a decimal? with
precision and scale, returning :clojure.spec.alpha/invalid if
unsuccessful.
Returns a `clojure.spec.alpha/conformer`, that conforms a `decimal?` with `precision` and `scale`, returning `:clojure.spec.alpha/invalid` if unsuccessful.
(byte-buffer? x)Is x an instance of a java.nio.ByteBuffer or any of its subclasses?
Is `x` an instance of a `java.nio.ByteBuffer` or any of its subclasses?
(bytes->decimal buffer-or-bytes precision scale)Converts a byte array or ByteBuffer containing the two's-complement
representation of an unscaled Integer value in big-endian byte
order to a BigDecimal.
Converts a byte array or `ByteBuffer` containing the two's-complement representation of an unscaled Integer value in big-endian byte order to a `BigDecimal`.
(decimal->bytes bd precision scale)Converts a BigDecimal bd to a ByteBuffer containing the
two's-complement representation of its underlying unscaled BigInteger value
in big-endian byte order.
Converts a `BigDecimal` `bd` to a `ByteBuffer` containing the two's-complement representation of its underlying unscaled `BigInteger` value in big-endian byte order.
(decimal->fixed bd precision scale)Converts a BigDecimal to a org.apache.avro.generic.GenericFixed
containing the two's-complement representation of its underlying unscaled
BigInteger value in big-endian byte order.
TODO FIXME not implemented
Converts a `BigDecimal` to a `org.apache.avro.generic.GenericFixed` containing the two's-complement representation of its underlying unscaled BigInteger value in big-endian byte order. TODO FIXME not implemented
(fixed->decimal fixed precision scale)Converts an org.apache.avro.generic.GenericFixed containing the
two's-complement representation of an unscaled Integer value in big-endian
byte order to a BigDecimal.
TODO FIXME not really implemented
Converts an `org.apache.avro.generic.GenericFixed` containing the two's-complement representation of an unscaled Integer value in big-endian byte order to a `BigDecimal`. TODO FIXME not really implemented
(s-conform-decimal precision scale bd)Conforms the decimal? bd with precision and scale, returning
:clojure.spec.alpha/invalid if unsuccessful.
This is the f in the call to clojure.spec.alpha/conformer.
NOTE you probably don't want to call this, use ->decimal-conformer instead.
Conforms the `decimal?` `bd` with `precision` and `scale`, returning `:clojure.spec.alpha/invalid` if unsuccessful. This is the `f` in the call to `clojure.spec.alpha/conformer`. NOTE you probably don't want to call this, use `->decimal-conformer` instead.
(set-precision bd precision)Sets the precision of a BigDecimal bd.
Sets the `precision` of a `BigDecimal` `bd`.
(set-scale bd scale)Sets the scale of a BigDecimal bd.
Sets the `scale` of a `BigDecimal` `bd`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |