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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

IEEE Floating-Point Overview<br />

This section answers some common questions about floating-point processing, such<br />

as:<br />

v How can I get predictable, consistent results?<br />

v How can I get the fastest or the most accurate results?<br />

v How can I detect, and possibly recover from, exception conditions?<br />

v Which compiler options can I use <strong>for</strong> floating-point calculations?<br />

Related In<strong>for</strong>mation: This section makes frequent reference to the compiler<br />

options that are grouped together in “Options <strong>for</strong><br />

Floating-Point Processing” on page 86, especially the “-qfloat<br />

Option” on page 163. The <strong>XL</strong> <strong>Fortran</strong> compiler also provides<br />

three intrinsic modules <strong>for</strong> exception handling and IEEE<br />

arithmetic support to help you write IEEE module-compliant<br />

code that can be more portable. See IEEE Modules and<br />

Support in the <strong>XL</strong> <strong>Fortran</strong> <strong>Enterprise</strong> <strong>Edition</strong> <strong>for</strong> <strong>AIX</strong> Language<br />

Reference <strong>for</strong> details.<br />

The use of the compiler options <strong>for</strong> floating-point calculations affects the accuracy,<br />

per<strong>for</strong>mance, and possibly the correctness of floating-point calculations. Although<br />

the default values <strong>for</strong> the options were chosen to provide efficient and correct<br />

execution of most programs, you may need to specify nondefault options <strong>for</strong> your<br />

applications to work the way you want. We strongly advise you to read this<br />

section be<strong>for</strong>e using these options.<br />

Note: The discussions of single-, double-, and extended-precision calculations in<br />

this section all refer to the default situation, with -qrealsize=4 and no<br />

-qautodbl specified. If you change these settings, keep in mind that the size<br />

of a <strong>Fortran</strong> REAL, DOUBLE PRECISION, and so on may change, but<br />

single precision, double precision, and extended precision (in lowercase) still<br />

refer to 4-, 8-, and 16-byte entities respectively.<br />

The in<strong>for</strong>mation in this section relates to floating-point processing on the<br />

PowerPC family of processors. The section “Floating-Point Processing on the<br />

POWER and POWER2 Architectures” on page 303 describes the differences<br />

between floating-point processing on the PowerPC processors and<br />

floating-point processing on the POWER and POWER2 processors.<br />

Here is a brief summary of the IEEE Standard <strong>for</strong> Floating-Point Arithmetic and the<br />

details of how it applies to <strong>XL</strong> <strong>Fortran</strong> on specific hardware plat<strong>for</strong>ms. For<br />

in<strong>for</strong>mation on the draft <strong>Fortran</strong> 2003 IEEE Module and arithmetic support, see the<br />

<strong>XL</strong> <strong>Fortran</strong> <strong>Enterprise</strong> <strong>Edition</strong> <strong>for</strong> <strong>AIX</strong> Language Reference.<br />

Compiling <strong>for</strong> Strict IEEE Con<strong>for</strong>mance<br />

By default, <strong>XL</strong> <strong>Fortran</strong> follows most, but not all of the rules in the IEEE standard.<br />

To compile <strong>for</strong> strict compliance with the standard:<br />

v Use the compiler option -qfloat=nomaf.<br />

v If the program changes the rounding mode at run time, include rrm among the<br />

-qfloat suboptions.<br />

© Copyright <strong>IBM</strong> Corp. 1990, 2004 287

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

Saved successfully!

Ooh no, something went wrong!