ItemValue
NameSIGNED-DECIMAL (spec document BIND SIGNED-DECIMAL)
TAG ID0x068L
Codec ID0x00000680
Spec document0x00000000/codecs/0x00000680/ (DECLARE target 0680)
Section3 0011 (Value), offset C within the section = 8
KindValue · family: DECIMAL
TAG WORD0000 0110 1000 LLLL (000K KKKC CCCC LLLL)
Index descriptionC×10^E of a signed exponent E and a minimum-WORD two’s complement coefficient C
Hugo sidevalue/decimal/signed-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)

SIGNED-DECIMAL is an exact decimal Value with a signed coefficient. Its direct Value code is 0x068L, family DECIMAL. The first 2 WORD of the Payload are the signed 32-bit decimal exponent E, and the rest is the minimum-WORD two’s complement coefficient C; the value is C×10^E.

Layout

TAG WORD          0000 0110 1000 LLLL      Codec 0x068L
[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)  Signed Two's-complement 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 two’s complement integer formed by concatenating all the remaining WORDs from the high WORD.
  • C follows the same minimum-WORD rule as SIGNED-INTEGER. Leading 0000 or FFFF WORDs that can be removed are 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
Payload 7 WORDdirect length LLLL=0111, total 8 WORDcanonical length structure

Format status

  • This layout, which binds a signed 32-bit exponent E and a minimum-WORD coefficient C, is a GEUL-specific format, not IEEE 754 decimal interchange or Apache Parquet DECIMAL.
  • Parquet DECIMAL uses unscaledValue × 10^(-scale) and required precision/scale metadata, stores the unscaled value of the byte-array physical type as a big-endian two’s complement, and has a scale of 0 or greater. This format puts a signed E in the body and has no precision metadata, so it is not the same format.
  • Exchanging values with IEEE 754 decimal or Parquet DECIMAL requires an explicit conversion that defines the 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/0x00000680/latest.geul as read with geul show (hexadecimal in uppercase).

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