Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

fpconstant

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

Syntax

Linux:

-fpconstant

-nofpconstant

macOS:

-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 2003 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 2003 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.

IDE Equivalent

Visual Studio: Floating-Point > Extend Precision of Single-Precision Constants

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 2003 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