Fortran Real Literal Constants Are Single Precision

Fortran real literal constants are by default single precision. It is important that care is taken when assigning a literal to a quad precision or double precision variable so that you get the expected results.

For example, consider these two assignments to B:

B = 3.1
B = 3.10000000000

If B is defined as double or quad precision, the literal constant is not. If you intend to B to contain or double or quad precision value, you need to write:

B = 3.1_8 for double precision


B = 3.1_16 for quad precision

Alternatively to using the notation above, you can use compiler options /real-size:64 (double precision) or /real-size:128 (quad precision). The Windows compiler options are listed. Please see the compiler documentation for Linux* and Mac OS X* compiler options.

These are just two of many ways to set precision of real literal contants.  For additional methods please consult a Fortran programming language reference manual.
For more complete information about compiler optimizations, see our Optimization Notice.