Figure 1-13. IEEE Double-precision Real Number Format

Conversion from HP 3000 format to IEEE format for a single-precision real n umber can present a range problem, because the IEEE range is smaller. Th us, over￿ow can occur in performing either of the follo wing conversions:

From an HP 3000 single-precision real n umber to an IEEE single-precision real n umber.

From an IEEE double-precision real n umber to an IEEE single-precision real n umber. You may have to develop new error handling code to prev ent over￿ow.

The mantissa of an HP 3000 double-precision real n umber provides enough bits for 16 digits of accuracy. The mantissa of an IEEE double-precision real n umber provides for 15.9 digits of accuracy. Thus, converting double-precision real n umbers from HP 3000 to IEEE format can incur an extremely small loss of n umeric precision. Ho wever, if the requiremen ts of an application depend on the ASCII represen tation of ￿oating-poin t results, the e￿ect of this accuracy di￿erence can be important.

For example, if a program assumes 16-digit accuracy and requests 16 digits for formatting output, with trailing zero suppression, the n umber 64.4 appears as 64.4 when the system is running in Compatibilit y Mode (CM) and 64.40000000000001 when the system is running in Native Mode (NM).

Rounding is frequen tly necessary when formatting output. In HP 3000 format, a n umber equidistant from two adjacent integers rounds to the in teger of greater magnitude. F or example, 1.5 rounds to 2, and 2.5 rounds to 3. In IEEE format, a n umber equidistan t from two adjacent integers rounds to the in teger that has a least signi￿can t bit of zero (in other words, the even integer). For example, 1.5 rounds to 2, and 2.5 also rounds to 2.

Converting Files

General procedures for con verting data ￿les from MPE V/E to MPE/iX are described below. For detailed information on con version, refer to Introduction to MPE/iX for MPE V Programmers (30367-90005) or the appropriate language man ual in the Migration Series .

The procedure for con verting HP FORTRAN 77 binary ￿les from MPE V/E to MPE/iX format is as follo ws:

1.Read data from ￿le in a subroutine with $HP3000_16 ON .

2.Pass the data to a subroutine that has $HP3000_16 OFF .

1-32 OVERVIEW