fpconstant

Tells the compiler that single-precision constants assigned to double-precision variables should be evaluated in double precision.

IDE Equivalent

Windows: Floating-Point > Extend Precision of Single-Precision Constants

Linux: None

Mac OS X: Floating-Point > Extend Precision of Single-Precision Constants

Architectures

IA-32, Intel® 64, IA-64 architectures

Syntax

Linux and Mac OS X:

-fpconstant

-nofpconstant

Windows:

/fpconstant

/nofpconstant

Arguments

None

Default

nofpconstant

Single-precision constants assigned to double-precision variables are evaluated in single precision according to Fortran 95/90 Standard rules.

Description

This option tells the compiler that single-precision constants assigned to double-precision variables should be evaluated in double precision.

This is extended precision. It does not comply with the Fortran 95/90 standard, which requires that single-precision constants assigned to double-precision variables be evaluated in single precision.

It allows compatibility with FORTRAN 77, where such extended precision was allowed. If this option is not used, certain programs originally created for FORTRAN 77 compilers may show different floating-point results because they rely on the extended precision for single-precision constants assigned to double-precision variables.

Alternate Options

None

Example

In the following example, if you specify fpconstant, identical values are assigned to D1 and D2. If you omit fpconstant, the compiler will obey the Fortran 95/90 Standard and assign a less precise value to D1:

REAL (KIND=8) D1, D2

DATA D1 /2.71828182846182/ ! REAL (KIND=4) value expanded to double

DATA D2 /2.71828182846182D0/ ! Double value assigned to double