fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |





The command CORRECT PRECISION OF REAL [LITERAL] NUMBERS instructs fpt to change real literal numbers in the code according to the following rules:

  1. If a kind tag is present, no change is made.
  2. If an exponent character other than "E" or "e" is present, no change is made.
  3. If the number is associated through assignment or by an arithmetic or relational operator to an object of higher precision, the number is changed to a double precision number by changing the exponent character to "D" or by adding the exponent "D0".
  4. If the number is an argument to an intrinsic function and the kind of the function is the kind of the argument, the number is promoted acording to rule 3, above, applied to the associations of the intrinsic function invocation.

If the command INSERT MONITOR OF CHANGED REAL NUMBERS is specified, and the value of the number is expected to be changed by the change in precision, a function or subroutine call is inserted to mark the change. If the number occurs in executable code, the change is marked by the function fun_fpt_changed_precision or the function fun_fpt_changed_complex for complex values. These functions have two arguments. The first is a unique integer marker which identifies the site of the number. The second is the changed number itself. The functions return the values of the number. If the changed number occurs in a non-executable statement, for example a PARAMETER statement, a DATA statement or a declaration, a call to the subroutine sub_fpt_changed_precision is inserted at the start of the sub-program in which it occurs. This has a single argument which identifies the location of the call. The two functions are declared wherever they are needed. In addition, calls to the routines fpt_init_check_literals and fpt_write_check_literals are inserted at the start and exit points of each main program respecively. These initialise the counters for visits to the changed numbers and report the number of visits. All of these routines are in the file fpt_monitor_literal_precision.f90 in the fpt_lib library.


This command uses a component of the fpt_lib library. Add a reference to the file FPTMAIN:monitor_changed_precision.fsp as the last reference in the project fsp file, or as the last componenbt on the operating system command line which launches fpt. This file contains the necessary commands and file references.

Where to use the commands

Operating system command line Yes
Configuration file, config.fsp No
Specification (fsp) files, *.fsp Yes
Interactively, to FPT> prompt Yes
Interactive command files Yes
Embedded in the Fortran code Yes


No change is made by default (Note that defaults may be changed in the configuration file).


The code:

PROGRAM project REAL (KIND=8) theta,r,x WRITE(6,'("r, theta: ",$)') READ(5,*)r,theta x = r * SIN ( 3.141592653589793 * theta / 180.0 ) WRITE(6,'("x: ",E24.14)')x END PROGRAM project

is modified by the command CORRECT PRECISION OF REAL NUMBERS to:

PROGRAM project REAL(KIND=8) theta, r, x WRITE (6,'("r, theta: ",$)') READ (5,*)r,theta x = r*SIN(3.141592653589793D0*theta/180.0D0) !----------------------------------^------------------------------------------- !!! fpt - 3743 Real literal precision increased with a small change in value !------------------------------------------------------------------------------ WRITE (6,'("x: ",E24.14)')x END PROGRAM project

Note that the value 180.0D0 is not marked by a diagnostic because its value is not expected to be changed.

The code is further modified by the command INSERT MONITOR OF CHANGED REAL NUMBERS to:

PROGRAM project REAL*8 fun_fpt_changed_precision REAL(KIND=8)theta,r,x CALL fpt_init_check_literals ! WRITE (6,'("r, theta: ",$)') READ (5,*)r,theta x = r*SIN(fun_fpt_changed_precision(1,3.141592653589793D0)*theta/180.0D0) WRITE (6,'("x: ",E24.14)')x ! CALL fpt_write_check_literals ! END PROGRAM project

Copyright ©1995 to 2024 Software Validation Ltd. All rights reserved.