Page 125 - Standard Handbook Of Petroleum & Natural Gas Engineering
P. 125
110 Mathematics
addition of control structures which eliminate the necessity for many
unstructured leaps of logic through the program. (See the FORTRAN
language section for details on structure and syntax of FORTRAN 77.)
3. Pascal: A general purpose language, designed by Niklaus Wirth specifically
to teach structured, modular programming and to provide reliable and efficient
programs on available computers. It provides a high degree of error checking
during compilation and an extensive set of data types. It also allows the use
of recursion, i.e., a procedure is allowed to call itself, which may produce
elegant solutions to certain types of problems. (See the Pascal language section
for details on structure and syntax of Wirth “standard” Pascal.)
Other familiar languages may be C, ADA, LISP, ALGOL, PL/I, Prolog, and APL
which are now available on many microcomputer systems.
Packaged programs are available in many areas of general interest to engineers,
including mathematics, statistics, and structural design. A number of vendors
also offer specialized petroleum engineering packages relating to such areas as
EOR, drilling fluids, corrosion control, cementing, and well production histories.
Some private vendors also maintain databases on specific subjects such as well
production histories.
Common Data Types
Although the number of data types available varies with the programming
language and a particular vendor’s restrictions and extensions of the standard,
the following types are particularly useful in scientific programming. (Some
languages permit user definition of nonstandard data types, usually for the
purpose of limiting the range of values accepted by a variable of that type.)
1. Integer-A signed number with no fractional part.
2. Real-A signed number with an integer part and a fractional part.
3. Double precision-Value stored as two words, rather than one, representing
a real number, but allowing for approximately double the number of
significant digits.
4. Complex-Value stored as two words, one representing the real part of the
number and the other representing the imaginary part.
5. Character-Alphanumerical item (2,m,!,etc.) represented in memory as a
binary code (see Table 1-22 for ASCII and Table 1-23 for EBCDIC).
6. Logical-Data type with only two possible values: True (represented as 1)
and False (represented as 0), also referred to as Boolean.
7. Pointer-Identifies addresses of other data items; used to create linked data
structures.
Common Data Structures
The following data structures are available, or can be constructed, in most
high-level languages.
1. Variable-Named data item of a specific type; may be assigned one or more
values during the course of a program run (in some languages, a constant
may be defined with a specified initial value which may not be changed).
2. Array-A collection of data items of the same type, referred to collectively
by a single name. The individual items, the array elements, are ordered by

