clj-cbor.tags.numbers

Built-in tag support for the number extensions in RFC 7049. See section 2.4.2.

big-decimal-tag

Tag 4 indicates a decimal fraction represented by a tagged array with two items, an integer exponent and an integer or bignum mantissa. The value of a decimal fraction is m*(10**e).

format-big-decimal

(format-big-decimal value)

format-bignum

(format-bignum value)

format-ratio

(format-ratio value)

negative-bignum-tag

Tag 3 is for negative bignums. These are encoded the same as for positive bignums (tag 2), but the value of the bignum is -1 - n.

number-read-handlers

Map of tag codes to read handlers to parse number values.

number-write-handlers

Map of number types to write handler functions.

parse-big-decimal

(parse-big-decimal value)

parse-negative-bignum

(parse-negative-bignum value)

parse-positive-bignum

(parse-positive-bignum value)

parse-ratio

(parse-ratio value)

positive-bignum-tag

Tag 2 is for positive bignums, which are encoded as a byte string data item. This is interpreted as an unsigned integer n in network byte order.

ratio-tag

Tag 30 is used to represent a rational number composed of two integers, a numerator and a denominator.

See: http://peteroupc.github.io/CBOR/rational.html