XL Fortran for AIX 8.1

User's Guide


Technical Details of the -qfloat=hsflt Option

The -qfloat=hsflt option is unsafe for optimized programs that compute floating-point values that are outside the range of representation of single precision, not just outside the range of the result type. The range of representation includes both the precision and the exponent range.

Even when you follow the rules that are stated in the preceding paragraph and in -qfloat Option, programs that are sensitive to precision differences might not produce expected results. Because -qfloat=hsflt is not compliant with IEEE in a number of ways, programs may not run correctly. If a program gives unexpected, incorrect, or unacceptable results when compiled with this option, use -qfloat=hssngl instead.

For example, in the following program, X.EQ.Y may be true or may be false:

    REAL X, Y, A(2)
    DOUBLE PRECISION Z
    LOGICAL SAME
 
    READ *, Z
    X = Z
    Y = Z
    IF (X.EQ.Y) SAME = .TRUE.
    ! ...
    ! ... Calculations that do not change X or Y
    ! ...
    CALL SUB(X)         ! X is stored in memory with truncated fraction.
    IF (X.EQ.Y) THEN    ! Result might be different than before.
    ...
 
    A(1) = Z
    X = Z
    A(2) = 1.           ! A(1) is stored in memory with truncated fraction.
    IF (A(1).EQ.X) THEN ! Result might be different than expected.
    ...

If the value of Z has fractional bits that are outside the precision of a single-precision variable, these bits may be preserved in some cases and lost in others. This makes the exact results unpredictable when the double-precision value of Z is assigned to single-precision variables. For example, passing the variable as a dummy argument causes its value to be stored in memory with a fraction that is truncated rather than rounded.

The speedup from this option is primarily for POWER and POWER2 machines. We recommend that it not be used for programs targeted (through the -qarch option) for PowerPC machines.


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