BIN

Synopsis

HELP:   Floating point number in binary format
TYPE:   OBJECT
SYNTAX: BIN(TYPE=SYSTEM/IEEE/HFP/DFP,ENDIAN=SYSTEM/BIG/LITTLE/LOCAL)

Description

Reads a binary representation of a floating point number. The result is an FL5-internal neutral real number representation which can be converted to any of the supported target real number representations by a corresponding write converter.

This converter supports the most common binary float sizes: 32, 64, and 128 bit. The input must be 4, 8, or 16 bytes long respectively. Floating point numbers are always signed.

With the TYPE parameter, the binary floating point representation can be selected. The following types are supported:

When reading HFP or DFP data exported from an IBM z/OS mainframe, ENDIAN=BIG must always be specified. IBM z/Architecture stores all floating point numbers in big-endian byte order. Using the default ENDIAN=SYSTEM on a little-endian host (Linux x86_64, Windows) will silently apply little-endian byte order and produce completely wrong results. Always use:

TYPE.FLOAT(FORMAT.BIN(TYPE=HFP ENDIAN=BIG))
TYPE.FLOAT(FORMAT.BIN(TYPE=DFP ENDIAN=BIG))

With the ENDIAN parameter, the byte order of the binary number can be specified. The following values are available:

With the WIDTH parameter, the bit width of the floating point value can be fixed to W32 (4 bytes), W64 (8 bytes), or W128 (16 bytes, HFP128 and DFP128 only). If WIDTH is not set, the width is determined by the length of the input buffer.

Arguments