Floating-Point and Simple Values
CBOR major type 7 encodes simple values (false=0xf4, true=0xf5, null=0xf6, undefined=0xf7) and IEEE 754 floating-point numbers (half=0xf9, single=0xfa, double=0xfb). The break code 0xff terminates indefinite-length structures.
Encoding
Major type 7 is the most heterogeneous major type. It covers:
Simple values (additional info 0-23): values 0-19 unassigned, 20 = false, 21 = true, 22 = null, 23 = undefined. Additional info 24 with one-byte value allows simple values 32-255.
Floating-point: additional info 25 = half-precision (2 bytes), 26 = single-precision (4 bytes), 27 = double-precision (8 bytes). All IEEE 754.
Break code: 0xff (additional info 31) terminates indefinite-length arrays, maps, byte strings, and text strings.
Key values: 0xf4 = false 0xf5 = true 0xf6 = null 0xf7 = undefined (rarely used) 0xf9 = half-precision float (2-byte IEEE 754) 0xfa = single-precision float (4-byte IEEE 754) 0xfb = double-precision float (8-byte IEEE 754) 0xff = break
Examples
| Label | Hex | Value |
|---|---|---|
| false | f4 | false |
| true | f5 | true |
| null | f6 | null |
| 1.1 (double) | fb 3f f1 99 99 99 99 99 9a | 1.1 (double-precision) |
| 0.0 (half) | f9 00 00 | 0.0 (half-precision) |
| break | ff | break (indefinite-length terminator) |