BIN

Synopsis

HELP:   Floating point number in binary format
TYPE:   OBJECT
SYNTAX: BIN(TYPE=SYSTEM,ENDIAN=SYSTEM/BIG/LITTLE/LOCAL,WIDTH=num/W32/W64)

Description

Writes a binary floating point representation of a real number, taking an FL5-internal neutral real number representation (produced by the reading counterpart) as input.

This converter supports the most common binary floating point sizes: 32 and 64 bit. Hence, the output of this converter is either 4 or 8 bytes long. The binary representation depends on the system, e.g. IEEE 754 on x86, hexadecimal floating-point on IBM mainframe. Floating point numbers are always signed.

The desired binary floating point width can be specified in two ways:

  1. Setting the WIDTH parameter to one of the supported bit widths results in binary floats of the specified width. If the number cannot be represented as a binary float of this width, a range error occurs.
  2. If the WIDTH parameter is omitted, the buffer given to the writer must be 4 or 8 bytes long and is filled with a binary float of the corresponding width. This allows using one converter handle to convert to binary of different bit widths, when using the byte interface (fcbconv()), by simply passing output buffers of different sizes. If the number cannot be represented as binary float of the given width, a range error occurs.

With the ENDIAN parameter, the endianness (byte order) of the binary number can be specified. By default, the system's endianness is used.

Arguments