Handling of Floating Point Items

You can configure floating point items to use either the IBM Hexadecimal format or the IEEE 754 format. The format is selected in the Copybook resource.

IEEE-754 and IBM Hexadecimal are two distantly different floating point formats. IBM hexadecimal is the format most commonly used on IBM mainframe computers. IEEE-754 is used by many other hardware platforms and software systems, including the Java virtual machine. The XML specification is also geared towards IEEE-754. Additionally, TIBCO ActiveMatrix BusinessWorks uses IEEE-754.

There are inherent differences in the degree of precision and the magnitude of the exponent offered by these two formats. The differences are:

  • IBM float and double formats use a 7 bit exponent value that represents an exponent of base 16.
  • IEEE formats use 8 bits for float and 11 bits for double that represents an exponent of base 2.
  • The remaining bits in both formats are used for precision so there are commensurate differences in the degree of precision available.

The plug-in is capable of processing IBM hexadecimal format. This functionality is available for COBOL only and is enabled using the Floating Point field in the Copybook resource.

Warning: PL/I copybooks can also contain IBM hexadecimal items as determined by Floating Point field and IEEE or HEXADEC attributes in the copybook text. However, hexadecimal items are presented as base64Binary, so the conversion described below is not in effect. For details, see BINARY FLOAT (precision) in Table 8, PL/I Data Types, on page 25.

For PRG copybooks F items are always processed as IEEE-754 and Floating Point field is not shown on the schema resource.

Conversion Details

When you select IEEE in the FLoating Point field and the copybook type is COBOL, the plug-in assumes that the binary contents of COMP-1 and COMP-2 items are in IBM hexadecimal format. Subsequent Parse activities convert from IBM hexadecimal to IEEE-754, and return these values as XML float or double items. Render activities perform the reverse operation.

Because of the inherent differences between these formats, it is important to keep the following rules under consideration:

  • If an overflow or underflow occurs when converting the exponent in either direction, the “Not a Number” or NaN value is returned.
  • These special values are mapped between the two formats: POSITIVE_INFINITY, NEGATIVE_INFINITY or NaN.
  • When converting the fraction component of a number, precision is lost because some of the right most bits might be truncated. This is known as no rounding policy.
  • If the loss of precision results in a zero fraction, zero is returned with no exponent value.
  • The sign is maintained across all translations.

It is also important note that the above-mentioned losses in precision can be compounded by similar losses in the conversions between IEEE-754 and XML. Wherever possible, choose a format with ample precision for your application. For example, if you are likely to push the limits of the Float format, choose Double where you are able.