24.05.2014 Views

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

v<br />

v<br />

Consider using only a subset of the overflow, underflow, zerodivide, invalid,<br />

and inexact suboptions with the -qflttrap option if you can identify some<br />

conditions that will never happen or you do not care about. In particular,<br />

because an inexact exception occurs <strong>for</strong> each rounding error, you probably<br />

should not check <strong>for</strong> it if per<strong>for</strong>mance is important.<br />

Include the imprecise suboption with the -qflttrap option, so that your compiler<br />

command looks similar to this:<br />

xlf90 -qflttrap=underflow:enable:imprecise does_underflows.f<br />

imprecise makes the program check <strong>for</strong> the specified exceptions only on entry<br />

and exit to subprograms that per<strong>for</strong>m floating-point calculations. This means<br />

that <strong>XL</strong> <strong>Fortran</strong> will eventually detect any exception, but you will know only the<br />

general area where it occurred, not the exact location.<br />

When you specify -qflttrap without imprecise, a check <strong>for</strong> exceptions follows<br />

each floating-point operation. If all your exceptions occur during calls to<br />

routines that are not compiled with -qflttrap (such as library routines), using<br />

imprecise is generally a good idea, because identifying the exact location will be<br />

difficult anyway.<br />

Note that enable has no effect if using the nanq suboption. nanq generates<br />

trapping code after each floating point arithmetic, load instruction and<br />

procedure returning floating point values even if imprecise is specified.<br />

Floating-Point Processing on the POWER and POWER2 Architectures<br />

The following section provides in<strong>for</strong>mation on floating-point processing on the<br />

POWER and POWER2 processors.<br />

Precision of Computations<br />

POWER and POWER2 floating-point hardware per<strong>for</strong>ms all calculations in IEEE<br />

double-precision mode. The hardware does not directly per<strong>for</strong>m single-precision<br />

calculations, but it is capable of generating single-precision results by using the<br />

following sequence of operations:<br />

1. Convert all single-precision operands of a single-precision operation to<br />

double-precision.<br />

2. Per<strong>for</strong>m the equivalent double-precision operation.<br />

3. Round the result to single-precision.<br />

This sequence always produces exactly the same bit-<strong>for</strong>-bit result, as if the<br />

single-precision IEEE operation had been per<strong>for</strong>med.<br />

As on the PowerPC machines, conversions from single-precision to<br />

double-precision have no negative per<strong>for</strong>mance impacts, but rounding operations<br />

from double-precision to single-precision do. Since the per<strong>for</strong>mance penalty of<br />

rounding operations would normally impact all single-precision computations on a<br />

POWER or POWER2 machine, the compiler attempts to reduce the number of<br />

rounding operations. It does this under the control of the norndsngl suboption of<br />

the -qfloat option.<br />

When you specify the norndsgnl suboption, the compiler leaves all intermediate<br />

results of single-precision operations in double-precision. That is, it suppresses the<br />

rounding operation in the above sequence. The compiler only per<strong>for</strong>ms a rounding<br />

operation on the final result of an expression, when it stores that result into a<br />

single-precision memory location.<br />

<strong>XL</strong> <strong>Fortran</strong> Floating-Point Processing 303

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!