Reading Binary Values
The receiver stores numbers in "Motorola" format. The byte order of these numbers is the opposite of what personal computers expect (Intel format). To supply or interpret binary numbers (8-byte DOUBLES, 4-byte LONGS, and 2-byte INTEGERS), the byte order of these values must be reversed. A detailed description of the "Motorola" format used to store numbers in the receiver is provided in different sections.
Integer Data Types
The INTEGER data types (CHAR, SHORT, and LONG) can be signed or unsigned. INTEGER data types are unsigned by default. All integer data types use two complement representations. For integer data types, refer to Table 1.
Integer Data Types     | |||
---|---|---|---|
Type     | Number of Bits     | Range of Values (Signed)     | Unsigned     |
Char     | 8     | -128 to 127     | 0 to 255     |
Short     | 16     | -32768 to 32767     | 0 to 65535     |
Long     | 32     | -2147483648 to 2147483647     | 0 to 4294967295     |
Floating Point Data Types
Floating-point data types are stored in the "IEEE SINGLE " and "DOUBLE" precision formats. Both formats have a sign bit field, an exponent field, and a fraction field. The fields represent floating-point numbers in the following manner: Floating-Point Number = <sign> 1.<fraction field> x 2 (exponent field> - bias).
Sign Bit Field - most significant bit of the floating-point number, sign bit is "0" for positive numbers and "1" for negative numbers.
Fraction Field - contains the fractional part of a normalized number. Normalized numbers are greater than or equal to 1 and less than 2.
Exponent Field - contains a biased exponent, a constant bias is subtracted from the number in the exponent field to yield the actual exponent. (The bias makes negative exponents possible.)
"NaN" - A "NaN"(Not a Number) is a special value that is used when the result of an operation is undefined. For example, dividing a number by zero results in a "NaN".
FLOAT Data Type
The "FLOAT" data type is stored in the "IEEE" single-precision format which is 32 bits long. The most significant bit is the sign bit. The next 8 most significant bits are the exponent field, and the remaining 23 bits are the fraction field. The bias of the exponent is 127. The floating-point number is precise to 6 decimal digits. For information refer to Illustration 1
Illustration 1 | g03379473 |
DOUBLE
The "DOUBLE" data type is stored in the "IEEE" double-precision format which is 64 bits long. The most significant bit is the sign bit. The next 11 most significant bits are the exponent field, and the remaining 52 bits are the fractional field. The bias of the exponent is 1023. The floating-point number is precise to 15 decimal digits. For information refer to Illustration 2
Illustration 2 | g03379557 |