GMP Integer Storage

GMP integers are stored in BCD
*Binary Coded Decimal, where each 4 bits represents one number 0-9. When viewed in a hex editor, BCD numbers may be read as base 10 numbers directly.
, most significant digit first, with a terminating nybble of 0xE for a positive number and 0xF for a negative number.
*Nybbles with value 0xA, 0xB and 0xC indicate corrupted or otherwise erroneously recorded data.
The ratio type is stored as two GMP integers back-to-back, but both integers are padded
*If 0xD appears immediately behind 0-9 values that is also an error, 0xD is used to pad the unused nybble in the final byte of a GMP encoding when the number has an even number of digits, plus the sign/terminator nybble, plus the 0xD padding nybble.
, if needed, to end on byte boundaries.

GMP integers (and the library used to work with them) can store and calculate with arbitrarily large numbers. For purposes of Assign Onward, only integers and ratios of integers are used, to explicitly avoid the ambiguity that can come from floating point arithmetic.

Deprecated, 2018 ideas:

GMP integers are stored in compact form, starting with a variable byte code
*Reality check: a single byte VBC represents numbers up to 63, 63 bytes of storage represents over 500 bits, or numbers ranging up to ±10150, aka sufficient.
indicating the number of bytes used to represent the integer, followed by the value with most significant byte first. The most significant bit
*of the first, most significant, byte
indicates the sign of the stored integer: set is negative. The sign bit is not included in the value of the integer. When necessary, a zero value most significant byte is prepended to achieve the required sign bit.

Rational fractions are stored as two integers, with two variable length byte encoded sizes: the first telling the size of the remaining size code plus the size of both integers
*aka total bytes remaining in the object, as is standard for all variable sized data items
followed by a variable byte encoded size of the numerator storage, followed by the numerator and denominator.