fpt and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Ref Manual Home |
DEFINE KIND
Syntax:
DEFINE LOGICAL KIND [:] <integer>[,] SIZE [:] <integer> DEFINE INTEGER KIND [:] <integer>[,] SIZE [:] <integer>[,] RANGE [:] <integer> DEFINE REAL KIND [:] <integer>[,] SIZE [:] <integer>[,] PRECISION [:] <integer>[,] EXPONENT [RANGE] [:] <integer> DEFINE COMPLEX KIND [:] <integer>[,] SIZE [:] <integer>[,] PRECISION [:] <integer>[,] EXPONENT [RANGE] [:] <integer>
Function:
These commands define the set of numeric kinds available on the target system (Note that the target system is not necessarily the system on which fpt is running).
In each case, the first argument is the kind value and the second is the data size - the number of bytes of storage which an object of the specified kind occupies.
The range of an integer kind is the number of decimal digits which can be represented accurately. For example, a twos complement INTEGER*2 variable can represent values from -32768 to +32767. This corresponds to a kind range of 4. An INTEGER*2 cannot represent all 5 digit decimal numbers.
The precision of a real or complex kind is the number of decimal digits which can always be represented precisely. The exponent range of a real or complex number is the largest exponent, or minus the smallest exponent, supported by the kind, whichever is the smaller. For example, an IEEE single precision floating point number has possible exponent values which support numbers from 10**-37 to 10**37, and therefore an exponent range of 37.
fpt uses these specifications:
If the kind defined already exists, the old values are overwritten.
Kinds may be removed from the list of available kinds by the command DELETE KIND.
Where to use these commands:
Operating system command line | Yes |
Configuration file, config.fsp | Yes |
Specification (fsp) files, *.fsp | Yes |
Interactively, to FPT> prompt | No |
Interactive command files | No |
Embedded in the Fortran code | No |
Default
The following kinds are defined by default.
LOGICAL KIND=1, SIZE=1 LOGICAL KIND=2, SIZE=2 LOGICAL KIND=4, SIZE=4 LOGICAL KIND=8, SIZE=8 INTEGER KIND=1, SIZE=1, RANGE=2 INTEGER KIND=2, SIZE=2, RANGE=4 INTEGER KIND=4, SIZE=4, RANGE=9 INTEGER KIND=8, SIZE=8, RANGE=18 REAL KIND=4, SIZE=4, PRECISION=6, EXPONENT=37 REAL KIND=8, SIZE=8, PRECISION=15, EXPONENT=307 REAL KIND=16, SIZE=16, PRECISION=33, EXPONENT=4931 COMPLEX KIND=4, SIZE=8, PRECISION=6, EXPONENT=37 COMPLEX KIND=8, SIZE=16, PRECISION=15, EXPONENT=307 COMPLEX KIND=16, SIZE=32, PRECISION=33, EXPONENT=4931
Copyright ©1995 to 2024 Software Validation Ltd. All rights reserved.