Skip to content

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.

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.

  1. Read the codec byte (1) and e. An e above 18 is out of range.
  2. Read the ints IntCol, then the two exception Flats.
  3. For each index i: if i is in the exception positions, the value is the f64 with the matching bit pattern. Otherwise the value is ints[i] / 10^e.

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 = 2
03 01 FA 01 06 40 26 03
ints: IntCol, count 3, FOR, min 125 (zvarint 250), width 6, offsets 0 25 50
00 00 00 exception positions: Flat, count 0, CONST 0
00 00 00 exception bit patterns: Flat, count 0, CONST 0

Decoded: 125 / 100 = 1.25, 150 / 100 = 1.5, 175 / 100 = 1.75.

  • e is at most 18.
  • Exception positions and exception bit patterns have the same count.
  • Counts are within their limits.

See How writers choose a codec.