FORTRAN 77 Language Reference

## Arithmetic

Table 6-1 Arithmetic Functions

Intrinsic Function

Definition

No. of

Args.

Generic

Name

Specific

Names

Argument

Type

Function Type

Absolute value

See Note (6).

|a| =

(ar**2+ai**2)**.5

ABSIABS ABS DABS CABS QABS @ ZABS @ CDABS @ CQABS @INTEGER REAL DOUBLE COMPLEX REAL*16 DOUBLE COMPLEX DOUBLE COMPLEX COMPLEX*32INTEGER REAL DOUBLE REAL REAL*16 DOUBLE DOUBLE REAL*16

Truncation

See Note (1).

int(a)

1AINTAINT DINT QINT @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Nearest whole number

int(a+.5) if a 0­­­­

int(a-.5) if a < 0

1ANINTANINT DNINT QNINT @REAL DOUBLE REAL*16REAL DOUBLE REAL*16

Nearest integer

int(a+.5) if a 0

int(a-.5) if a < 0

1NINTNINT IDNINT IQNINT @REAL DOUBLE REAL*16INTEGER INTEGER INTEGER

Remainder

See Note (1).

a1-int(a1/a2)*a2

MODMOD AMOD DMOD QMOD @INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

Transfer of sign

|a1| if a2 0

-|a1| if a2 < 0

SIGNISIGN SIGN DSIGN QSIGN @INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

Positive difference

a1-a2 if a1 > a2

0 if a1 £ a2

DIMIDIM DIM DDIM QDIM @INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

a1 * a2

-DPROD QPROD @REAL DOUBLEDOUBLE REAL*16

Choosing largest value

max(a1, a2, ...)

MAX MAX0 AMAX1 DMAX1 QMAX1 @INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

AMAX0AMAX0INTEGERREAL

MAX1MAX1REALINTEGER

Choosing smallest value

min(a1, a2, ...)

MIN MIN0 AMIN1 DMIN1 QMIN1 @INTEGER REAL DOUBLE REAL*16INTEGER REAL DOUBLE REAL*16

AMIN0AMIN0INTEGERREAL

MIN1MIN1REALINTEGER