XL Fortran for AIX 8.1

User's Guide


Floating-Point Processing on the POWER and POWER2 Architectures

The following section provides information on floating-point processing on the POWER2 and POWER2 processors.

Precision of Computations

POWER and POWER2 floating-point hardware performs all calculations in IEEE double-precision mode. The hardware does not directly perform single-precision calculations, but it is capable of generating single-precision results by using the following sequence of operations:

  1. Convert all single-precision operands of a single-precision operation to double-precision.
  2. Perform the equivalent double-precision operation.
  3. Round the result to single-precision.

This sequence always produces exactly the same bit-for-bit result, as if the single-precision IEEE operation had been performed.

As on the PowerPC machines, conversions from single-precision to double-precision have no negative performance impacts, but rounding operations from double-precision to single-precision do. Since the performance penalty of rounding operations would normally impact all single-precision computations on a POWER or POWER2 machine, the compiler attempts to reduce the number of rounding operations. It does this under the control of the norndsngl suboption of the -qfloat option.

When you specify the norndsgnl suboption, the compiler leaves all intermediate results of single-precision operations in double-precision. That is, it suppresses the rounding operation in the above sequence. The compiler only performs a rounding operation on the final result of an expression, when it stores that result into a single-precision memory location.

The following example shows the difference between using the norndsngl and the rndsngl suboptions:

REAL(4) a,b,c,d
...
a = b + c + d

With norndsngl, the compiler does the following:

  1. Performs the intermediate computation of b + c in double precision without rounding.
  2. Adds the double-precision result to d.
  3. Rounds the final double-precision result and then stores it into variable a.

With rndsngl, the compiler follows the same steps except that it performs rounding in the first step. Note that norndsngl maintains increased precision for intermediate results and improves performance, but you may need to specify rndsngl to produce results that are bit-for-bit identical to those computed on other systems.

norndsngl is the default when you use -qarch to target a POWER, a POWER2, or a common architecture. rndsngl is the default when you target a PowerPC architecture. You can also explicitly set the rndsngl suboption for any target architecture.

Invalid Operation Exceptions for SQRT Operations on POWER Processors

The POWER architecture does not include a hardware status flag to indicate IEEE invalid operation exceptions that are caused by attempting to compute the square root of a negative number. Instead, the operating system must handle those exceptions by using a software mechanism. Therefore, using SQRT for a negative number may not reliably generate invalid operation exceptions on POWER platforms, depending on the level of the operating system installed on the computer.

The POWER2 architecture and many PowerPC architectures each has a hardware status flag for invalid SQRT operations, and each reliably generates exceptions.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]