Intel fortran-80 manual Sperim = 4*S Sqarea = S**2, Sqdiag = Sqrt 2*S* *2

Models: fortran-80

1 130
Download 130 pages 742 b
Page 19
Image 19

FORTRAN-80

FORTRAN Concepts

2.2.4 Expressions and Operators

An expression is a combination of numbers, symbols, and operators. It may include parentheses and may also include functions (discussed in Chapter 5). Expressions appear in assignment statements (e.g., A = B + C) as controls in certain data pro- cessing statements (e.g., IF FLAG .NE. 3 GO TO 250), and in subroutine calls (CALLSUB(X+l, Y).

FORTRAN has four kinds of

2.2.4.1Character Expressions. A character expression consists of either a character constant, a character variable reference, or a character array element reference. The expression may be enclosed in parentheses.

2.2.4.2Arithmetic Expressions. An arithmetic expression performs a numeric computation. This computation is limited by the range and precision of numeric values representable in the processor (see section F.l). If any part of the computa- tion produces values outside this range, the results are undefined.

Arithmetic operands must identify values of type integer or real.

2.2.4.2.1 Arithmetic Operators. The arithmetic operators are:

Operator Meaning

**Exponentiation

/Division

*Multiplication

+Unary or binary addition Unary or binary subtraction

The following expressions calculate the perimeter, area, and diagonal length of a square with side length'S.'

SPERIM = 4*S

SQAREA = S**2

SQDIAG = SQRT (2*(S* *2))

2-7

Page 19
Image 19
Intel fortran-80 manual Sperim = 4*S Sqarea = S**2, Sqdiag = Sqrt 2*S* *2