The six types of data are:
- Integer
- Real
- Double precision
- Complex
- Logical
- Character
Each type is different and may have a different internal
representation. The type may affect the interpretation of
the operations involving the datum.
The name employed to identify a datum or a function also
identifies its data type. A symbolic name representing a
constant, variable, array, or function (except a generic
function) must have only one type for each program unit.
Once a particular name is identified with a particular type
in a program unit, that type is implied for any usage of the
name in the program unit that requires a type.
A symbolic name that identifies a constant, variable, array,
external function, or statement function may have its type
specified in a type-statement (
8.4) as integer, real, double
precision, complex, logical, or character. In the absence
of an explicit declaration in a type-statement, the type is
implied by the first letter of the name. A first letter of
I, J, K, L, M, or N implies type integer and any other
letter implies type real, unless an IMPLICIT statement (
8.5)
is used to change the default implied type.
The data type of an array element name is the same as the
type of its array name.
The data type of a function name specifies the type of the
datum supplied by the function reference in an expression.
A symbolic name that identifies a specific intrinsic
function in a program unit has a type as specified in
15.10.
An explicit type-statement is not required; however, it
is permitted. A generic function name does not have a
predetermined type; the result of a generic function
reference assumes a type that depends on the type of the
argument, as specified in
15.10.
If a generic function name appears in a type-statement,
such an appearance is not sufficient by itself to remove
the generic properties from that function.
In a program unit that contains an external function
reference, the type of the function is determined in the
same manner as for variables and arrays.
The type of an external function is specified
implicitly by its name, explicitly in a FUNCTION
statement, or explicitly in a type-statement.
Note that an
IMPLICIT statement within a function subprogram may affect
the type of the external function specified
in the subprogram.
A symbolic name that identifies a main program, subroutine,
common block, or block data subprogram has no data type.
The mathematical and representation properties for each of
the data types are specified in the following sections. For
real, double precision, and integer data, the value zero is
considered neither positive nor negative. The value of a
signed zero is the same as the value of an unsigned zero.
A
constant
is an arithmetic constant, logical constant, or
character constant. The value of a constant does not
change. Within an executable program, all constants that
have the same form have the same value.
The form of the string representing a constant specifies
both its value and data type. A PARAMETER statement (
8.6)
allows a constant to be given a symbolic name.
The symbolic name of a constant must not be used to form
part of another constant.
Blank characters occurring in a constant, except in a
character constant, have no effect on the value of the
constant.
Integer, real, double precision, and complex constants are
arithmetic constants.
An
unsigned constant
is a constant without a leading sign.
A
signed constant
is a constant with a leading plus or minus
sign. An
optionally signed constant
is a constant that may
be either signed or unsigned. Integer, real, and double
precision constants may be optionally signed constants,
except where specified otherwise.
An integer datum is always an exact representation of an
integer value. It may assume a positive, negative, or zero
value. It may assume only an integral value. An integer
datum has one numeric storage unit in a storage sequence.
The form of an
integer constant
is an optional sign followed
by a nonempty string of digits. The digit string is
interpreted as a decimal number.
A real datum is a processor approximation to the value of a
real number. It may assume a positive, negative, or zero
value. A real datum has one numeric storage unit in a
storage sequence.
The form of a
basic real constant
is an optional sign, an
integer part, a decimal point, and a fractional part, in
that order. Both the integer part and the fractional part
are strings of digits; either of these parts may be omitted
but not both. A basic real constant may be written with
more digits than a processor will use to approximate the
value of the constant. A basic real constant is interpreted
as a decimal number.
The form of a
real exponent
is the letter E followed by an
optionally signed integer constant. A real exponent denotes
a power of ten.
The forms of a
real constant
are:
- Basic real constant
- Basic real constant followed by a real exponent
- Integer constant followed by a real exponent
The value of a real constant that contains a real exponent
is the product of the constant that precedes the E and the
power of ten indicated by the integer following the E.
The integer constant part of form (3) may be written
with more digits than a processor will use to approximate
the value of the constant.
A double precision datum is a processor approximation to the
value of a real number. The precision, although not
specified, must be greater than that of type real. A double
precision datum may assume a positive, negative, or zero
value. A double precision datum has two consecutive numeric
storage units in a storage sequence.
The form of a
double precision exponent
is the letter D
followed by an optionally signed integer constant. A double
precision exponent denotes a power of ten. Note that the
form and interpretation of a double precision exponent are
identical to those of a real exponent, except that the letter D is
used instead of the letter E.
The forms of a
double precision constant
are:
- Basic real constant followed by a double precision
exponent
- Integer constant followed by a double precision
exponent
The value of a double precision constant is the product of
the constant that precedes the D and the power of ten
indicated by the integer following the D.
The integer constant part of form (2) may be written
with more digits than a processor will use to approximate
the value of the constant.
A complex datum is a processor approximation to the value of
a complex number. The representation of a complex datum is
in the form of an ordered pair of real data. The first of
the pair represents the real part of the complex datum and the
second represents the imaginary part. Each part has the
same degree of approximation as for a real datum. A complex
datum has two consecutive numeric storage units in a storage
sequence; the first storage unit is the real part and the
second storage unit is the imaginary part.
The form of a
complex constant
is a left parenthesis
followed by an ordered pair of real or integer
constants separated by a comma, and followed by a right
parenthesis. The first constant of the pair is the
real part of the complex constant and the second is the
imaginary part.
A logical datum may assume only the values true or false. A
logical datum has one numeric storage unit in a storage
sequence.
The forms and values of a
logical constant
are:
________ _______
| | |
|__Form__|_Value_|
| | |
| .TRUE. | true |
| | |
| .FALSE.| false|
| | |
|________|_______|
A character datum is a string of characters. The string may
consist of any characters capable of representation in the
processor. The blank character is valid and significant in
a character datum. The
length
of a character datum is the
number of characters in the string. A character datum has
one character storage unit in a storage sequence for each
character in the string.
Each character in the string has a character position that
is numbered consecutively 1, 2, 3, etc. The number
indicates the sequential position of a character in the
string, beginning at the left and proceeding to the right.
The form of a
character constant
is an apostrophe followed
by a nonempty string of characters followed by an
apostrophe. The string may consist of any characters
capable of representation in the processor. Note that the
delimiting apostrophes are not part of the datum represented
by the constant. An apostrophe within the datum string is
represented by two consecutive apostrophes with no
intervening blanks. In a character constant, blanks
embedded between the delimiting apostrophes are significant.
The length of a character constant is the number of
characters between the delimiting apostrophes, except that
each pair of consecutive apostrophes counts as a single
character. The delimiting apostrophes are not counted. The
length of a character constant must be greater than zero.
[Contents] [Previous]
[Next] [Home]
NDP77
http://www.ndp77.net
webmaster MFA (main)
webmaster@ndp77.net