Type 7 – Floats & control tokens

This type combines two completely unrelated types of items – floating point numbers and special values such as true, false, null, etc. We refer to these special values as ‘control values’ or ‘ctrls’ for short throughout the code.

Just like integers, they have different possible width (resulting in different value ranges and precisions).

Warning

doxygenenum: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Corresponding cbor_type CBOR_TYPE_FLOAT_CTRL
Number of allocations One per lifetime
Storage requirements sizeof(cbor_item_t) + 1/4/8

Getting metadata

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Reading data

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Creating new items

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Building items

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Manipulating existing items

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml

Half floats

CBOR supports two bytes wide (“half-precision”) floats which are not supported by the C language. libcbor represents them using float values throughout the API, which has important implications when manipulating these values.

In particular, if a user uses some of the manipulation APIs (e.g. cbor_set_float2(), cbor_new_float2()) to introduce a value that doesn’t have an exect half-float representation, the encoding semantics are given by cbor_encode_half() as follows:

Warning

doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml