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.

-qdpc Option<br />

Syntax<br />

-qdpc[=e] | -qnodpc<br />

DPC[(E)] | NODPC<br />

Increases the precision of real constants, <strong>for</strong> maximum accuracy when assigning<br />

real constants to DOUBLE PRECISION variables. This language extension might<br />

be needed when you are porting programs from other plat<strong>for</strong>ms.<br />

Rules<br />

If you specify -qdpc, all basic real constants (<strong>for</strong> example, 1.1) are treated as<br />

double-precision constants; the compiler preserves some digits of precision that<br />

would otherwise be lost during the assignment to the DOUBLE PRECISION<br />

variable. If you specify -qdpc=e, all single-precision constants, including constants<br />

with an e exponent, are treated as double-precision constants.<br />

This option does not affect constants with a kind type parameter specified.<br />

Examples<br />

@process nodpc<br />

subroutine nodpc<br />

real x<br />

double precision y<br />

data x /1.000000000001/<br />

data y /1.000000000001/<br />

print *, x, y, x .eq. y<br />

end<br />

@process dpc<br />

subroutine dpc<br />

real x<br />

double precision y<br />

data x /1.000000000001/<br />

data y /1.000000000001/<br />

print *, x, y, x .eq. y<br />

end<br />

! The trailing digit is lost<br />

! The trailing digit is lost<br />

! So x is considered equal to y<br />

! The trailing digit is lost<br />

! The trailing digit is preserved<br />

! So x and y are considered different<br />

program testdpc<br />

call nodpc<br />

call dpc<br />

end<br />

When compiled, this program prints the following:<br />

1.000000000 1.00000000000000000 T<br />

1.000000000 1.00000000000100009 F<br />

showing that with -qdpc the extra precision is preserved.<br />

Related In<strong>for</strong>mation<br />

“-qautodbl Option” on page 134 and “-qrealsize Option” on page 222 are more<br />

general-purpose options that can also do what -qdpc does. -qdpc has no effect if<br />

you specify either of these options.<br />

152 <strong>XL</strong> <strong>Fortran</strong> <strong>Enterprise</strong> <strong>Edition</strong> <strong>for</strong> <strong>AIX</strong> : User’s <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!