-qdpc

Category

Floating-point and integer control

Purpose

Increases the precision of real constants for maximum accuracy, when assigning real constants to DOUBLE PRECISION variables.

This language extension might be needed when you are porting programs from other platforms.

Format

Read syntax diagramSkip visual syntax diagram
        .-nodpc---------.   
>>- -q--+-dpc--+------+-+--------------------------------------><
               '-=--e-'     

@PROCESS:

@PROCESS DPC[(E)] | NODPC

Defaults

-qnodpc

Usage

If you specify -qdpc, all basic real constants (for example, 1.1) are treated as double-precision constants; the compiler preserves some digits of precision that would otherwise be lost during the assignment to the DOUBLE PRECISION variable. If you specify -qdpc=e, all single-precision constants, including constants with an e exponent, are treated as double-precision constants.

This option does not affect constants with a kind type parameter specified.

-qautodbl and -qrealsize are more general-purpose options that can also do what -qdpc does. -qdpc has no effect if you specify either of these options.

Examples

@process nodpc
        subroutine nodpc
        real x
        double precision y
        data x /1.000000000001/  ! The trailing digit is lost
        data y /1.000000000001/  ! The trailing digit is lost

        print *, x, y, x .eq. y  ! So x is considered equal to y
        end

@process dpc
        subroutine dpc
        real x
        double precision y
        data x /1.000000000001/  ! The trailing digit is lost
        data y /1.000000000001/  ! The trailing digit is preserved

        print *, x, y, x .eq. y  ! So x and y are considered different
        end

        program testdpc
        call nodpc
        call dpc
        end

When compiled, this program prints the following:

   1.000000000       1.00000000000000000     T
   1.000000000       1.00000000000100009     F

showing that with -qdpc the extra precision is preserved.