Tuesday, February 04, 2014

[qsldbaoy] Standard base and width notation

Start with an abstract mathematical notion of an integer and standardize ways of expressing how that number is transformed to a data object of a given number of digits (width) in a given base.

Inspired by Verilog notation for numeric literals: 6'b001100 = 6'b1100.

My notation would not specify endianness, how the data is serialized or laid out in memory.  That would be a later step.  Data remains abstractly data.

Padding to the left with zeroes would be the most common case, but other paddings are possible.

A 00042
B 42000 (loses information encoding 42 versus 420)
C 41999 (like 0.41999... = 0.42)
D 24000 (reverse of A, redundant with endian choice)
E 23999 (0.23999... = 0.24)
F 99932 (reverse of E, redundant with endian choice)
G 99958 (like two's complement of negative binary, also p-adic numbers,  A+G=0)

The padding cannot be computed as a mathematical transformation on the original integer without knowing the width and base.  And after the transformation, the data is no longer a mathematical number and cannot be manipulated as such.

No comments :