ItemValue
NameUNSIGNED-DECIMAL (spec document BIND UNSIGNED-DECIMAL)
TAG ID0x069L
Codec ID0x00000690
Spec document0x00000000/codecs/0x00000690/ (DECLARE target 0690)
Section3 0011 (Value), offset C within the section = 9
KindValue · family: DECIMAL
TAG WORD0000 0110 1001 LLLL (000K KKKC CCCC LLLL)
Index descriptionC×10^E of a signed exponent E and a minimum-WORD unsigned coefficient C
Hugo sidevalue/decimal/unsigned-decimal.md

Fields (spec document)

The order of FIELDs in the document is the order of the Payload fields (Codec spec document).

OrderField (BIND)FIELDWidthReceiving format (CODEC)ENUM
1exponent#2raw value, 2 WORD
2coefficient#3remaining raw value (0xFFFF)

UNSIGNED-DECIMAL is an exact decimal Value with an unsigned coefficient. Its direct Value code is 0x069L, family DECIMAL. The first 2 WORD of the Payload are the signed 32-bit decimal exponent E, and the rest is the minimum-WORD unsigned coefficient C; the value is C×10^E.

Layout

TAG WORD          0000 0110 1001 LLLL      Codec 0x069L
[Length extension TAG] when the total is 15 WORD or more
Payload WORD 1st–2nd (32 bit)       Signed Base-10 Exponent E
Payload WORD 3rd–Nth (1 WORD or more)  Unsigned Coefficient C

Interpretation

  • E is a signed 32-bit big-endian two’s complement integer written from the high WORD.
  • C is an arbitrary-precision unsigned magnitude read from all the remaining WORDs starting at the high WORD.
  • C follows the same minimum-WORD rule as UNSIGNED-INTEGER. 0 is 0000, and for 2 WORD or more a first WORD of 0000 is forbidden.

Length and validity

  • The total is the WORD count of the TAG 1 WORD, the Length extension TAG (if any), and the Payload. Up to 14 WORD uses the direct length, and 15 WORD or more uses the 1110/1111 extended length; the extension TAG is also counted in the total (Record and TAG WORD).
  • The Payload is the exponent 2 WORD plus the coefficient 1 WORD or more, so it is at least 3 WORD.
  • The canonicality of the byte representation checks only the minimum-WORD representation of the coefficient.

Examples

Value representationPayload (E + C)Verdict
1×10^00000 0000 0001byte representation canonical
10×10^-1FFFF FFFF 000Abyte representation canonical; the canonical relation to the representation above is an open problem
1×10^00000 0000 0000 0001non-canonical: leading 0000 of the coefficient is unnecessary
negative coefficientnot applicableinvalid

Format status

  • This layout, which binds a signed 32-bit exponent E and an unsigned minimum-WORD coefficient C, is a GEUL-specific format, not IEEE 754 decimal interchange or Apache Parquet DECIMAL.
  • Parquet DECIMAL uses a signed unscaled value, unscaledValue × 10^(-scale), and required precision/scale metadata; the byte-array physical type is a big-endian two’s complement and the scale is 0 or greater. This format is not the same because of the unsigned C, the signed E, and the absence of precision metadata.
  • Exchanging values with IEEE 754 decimal or Parquet DECIMAL requires an explicit conversion that defines the sign, range, precision/scale, quantum, and special-value policy.
  • Comparison basis: IEEE 754-2019, Apache Parquet Logical Types — DECIMAL

Open problems

  • There are several exponent/coefficient pairs that represent the same number, such as 10×10^-1 and 1×10^0.
  • Whether this format preserves the quantum, how value equality is decided, and how the canonical exponent is normalized have not been decided yet.
  • So an implementation must not arbitrarily enforce exponent/coefficient normalization beyond the coefficient minimum-WORD rule.

Spec document source

This is the spec document 0x00000000/codecs/0x00000690/latest.geul as read with geul show (hexadecimal in uppercase).

SPEC-VERSION 0x0001
DOC-ID 0x0426000000000000069000000000
BODY
#1 DECLARE 0x0690
#2 FIELD #1 0x0002
#3 FIELD #1 rest
#4 BIND #1 "UNSIGNED-DECIMAL"
#5 BIND #2 "exponent"
#6 BIND #3 "coefficient"