BIN and the integer types

An item of type BIN is interpreted as a binary value. The length can be 4, 9, or 18 and reflects the number of positive digits in decimal format, including any decimal places. The value -12.34, for example, fits in an item of length 4. A 4-digit number requires 2 bytes; a 9-digit number requires 4 bytes; and an 18-digit number requires 8 bytes.

For an item of length 4, the internal bit representations of example values are as follows:

  // for decimal 1234, the hexadecimal value is 04 D2:
  00000100 11010010

  // for decimal -1234, the value is the 2's complement (FB 2E):
  11111011 00101110

It is recommended that you use items of type BIN instead of other numeric types whenever possible; for example, for arithmetic operands or results, for array subscripts, and for key items in relative records.

The following types are equivalent to type BIN:

Related reference
Primitive types