ALP
ALP stores floats that are really decimals (such as 1.25 or 19.99) as integers and a decimal exponent. Values that do not fit that scheme are listed as exceptions. It is codec id 1 in FloatCol.
Layout
Section titled “Layout”| Field | Encoding | Meaning |
|---|---|---|
| codec | u8 | 1 |
| e | u8 | decimal exponent, at most 18 |
| ints | IntCol | one integer per value |
| exception positions | Flat | indexes of the exceptions |
| exception bit patterns | Flat | the f64 bit pattern of each exception |
There is no separate count: the number of values is the count of the ints IntCol. Each IntCol and Flat has its own count, codec byte and body, see Column container types.
How to decode
Section titled “How to decode”- Read the codec byte (1) and
e. Aneabove 18 is out of range. - Read the
intsIntCol, then the two exception Flats. - For each index
i: ifiis in the exception positions, the value is thef64with the matching bit pattern. Otherwise the value isints[i] / 10^e.
Illustration
Section titled “Illustration”Derived by hand, not from a real file. The values 1.25, 1.5, 1.75 with e = 2 have the integers 125, 150, 175 and no exceptions.
01 02 codec ALP, e = 203 01 FA 01 06 40 26 03 ints: IntCol, count 3, FOR, min 125 (zvarint 250), width 6, offsets 0 25 5000 00 00 exception positions: Flat, count 0, CONST 000 00 00 exception bit patterns: Flat, count 0, CONST 0Decoded: 125 / 100 = 1.25, 150 / 100 = 1.5, 175 / 100 = 1.75.
Checks
Section titled “Checks”eis at most 18.- Exception positions and exception bit patterns have the same count.
- Counts are within their limits.
When writers pick it
Section titled “When writers pick it”See How writers choose a codec.