Next: Literal Constants
Up: Data Objects
Previous: Data Objects
Fortran 90 has three broad classes of object type,
- character;
- boolean;
- numeric.
these give rise to five simple intrinsic types, known a default types,
- CHARACTER for strings of one or more characters;
- LOGICAL for objects which have the values true or false;
- REAL (and DOUBLE PRECISION) for approximate, possibly fractional numbers;
- INTEGER for exact whole numbers;
- COMPLEX for representing numbers of the form: .
For example,
CHARACTER :: sex ! letter
CHARACTER(LEN=12) :: name ! string
LOGICAL :: wed ! married?
REAL :: height
DOUBLE PRECISION :: pi ! 3.14...
INTEGER :: age ! whole No.
COMPLEX :: val ! x + iy
Each type has
- a name
- a set of valid values
- a means to denote values
- a set of operators
Note,
- Most programming languages have the same broad classes of objects.
- The three broad classes cannot be intermixed without some sort of
type coercion being performed.
- REAL and DOUBLE PRECISION objects are approximate. DOUBLE PRECISION
should not now be used. In FORTRAN 77 an object of this type had greater
precision than REAL, in Fortran 90 the precision of a REAL object may
be specified making the DOUBLE PRECISION data type redundant.
- All numeric types have finite range.
- A default type is not parameterised by a kind value.
Return to corresponding overview page
Next: Literal Constants
Up: Data Objects
Previous: Data Objects
©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997Not for commercial use.