This is an old revision of the document!
Number formats used in API
Many numbers do not fit into a single byte [0..255] range and for those there are conventions throughout our API on how to encode them.
BYTE
An 8-bit unsigned or signed value representing a decimal range of [0..255] or [-128..127] respectively. Bits are ordered the “usual” way with the MSB on the left and LSB on the right.
A couple of examples (decimal = bits):
1=00000001both signed and unsigned253=11111101(unsigned only)-3=11111101(signed only)
UFIX 8.8
This is a 16-bit value in which 8 MSB represent the unsigned integer part of the number and the 8 LSB represent the fractional part. The fractional value is the LSB x 256, i.e. the smallest “increment” for this format is 1/256 or 0.00390625.
Numbers in this format represent a decimal range of [0.0..256).
A few examples (decimal = MSB, LSB):
0.0=0x00,0x001.0=0x01,0x001.5=0x01,0xF0127.3=0x7F,0x4D- notice how the actual precise decimal number127 + 77/256is not exactly127.3but is an approximation with a precise decimal value of127.30078125-1- unrepresentable256=0xFF,0xFF- once again, the actual decimal number is “very close” and is in fact255.99609375