FPT and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Reference Manual Home |


DEFINE KIND

FPT version:

These commands were first implemented in FPT 3.3-h.


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

Yes


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
INTEGER KIND=2,  SIZE=2
INTEGER KIND=4,  SIZE=4
INTEGER KIND=8,  SIZE=8
 
REAL KIND=4,     SIZE=4
REAL KIND=8,     SIZE=8
REAL KIND=16,    SIZE=16
 
COMPLEX KIND=4,  SIZE=8
COMPLEX KIND=8,  SIZE=16
COMPLEX KIND=16, SIZE=32

The range, precision and exponent range values of the pre-defined kinds are not defined. It is the responsibility of the user to set them up if they will be required.


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