Sun Studio 12: Fortran Library Reference

## 3.1.1 Arithmetic Functions

Table 3–1 Fortran 77 Arithmetic Functions

Intrinsic Function

Definition

No. of

Args.

Generic

Name

Specific

Names

Argument

Type

Function Type

Absolute value

See Note (6).

|a| =

(ar2+ai2)1/2

ABS

IABS

ABS

DABS

CABS

QABS ¤

ZABS ¤

CDABS ¤

CQABS ¤

INTEGER

REAL

DOUBLE

COMPLEX

REAL*16

DOUBLE COMPLEX

DOUBLE COMPLEX

COMPLEX*32

INTEGER

REAL

DOUBLE

REAL

REAL*16

DOUBLE

DOUBLE

REAL*16

Truncation

See Note (1).

int(a)

AINT

AINT

DINT

QINT ¤

REAL

DOUBLE

REAL*16

REAL

DOUBLE

REAL*16

Nearest whole number

int(a+.5) if a ≥ 0

int(a-.5) if a < 0

ANINT

ANINT

DNINT

QNINT ¤

REAL

DOUBLE

REAL*16

REAL

DOUBLE

REAL*16

Nearest integer

int(a+.5) if a ≥ 0

int(a-.5) if a < 0

NINT

NINT

IDNINT

IQNINT ¤

REAL

DOUBLE

REAL*16

INTEGER

INTEGER

INTEGER

Remainder

See Note (1).

a1-int(a1/a2)*a2

MOD

MOD

AMOD

DMOD

QMOD ¤

INTEGER

REAL

DOUBLE

REAL*16

INTEGER

REAL

DOUBLE

REAL*16

Transfer of sign

|a1| if a2 ≥ 0

-|a1| if a2 < 0

SIGN

ISIGN

SIGN

DSIGN

QSIGN ¤

INTEGER

REAL

DOUBLE

REAL*16

INTEGER

REAL

DOUBLE

REAL*16

Positive difference

a1-a2 if a1 > a2

0 if a1≤ a2

DIM

IDIM

DIM

DDIM

QDIM ¤

INTEGER

REAL

DOUBLE

REAL*16

INTEGER

REAL

DOUBLE

REAL*16

a1 * a2

-

DPROD

QPROD ¤

REAL

DOUBLE

DOUBLE

REAL*16

Choosing largest value

max(a1, a2, …)

≥2

MAX

MAX0

AMAX1

DMAX1

QMAX1 ¤

INTEGER

REAL

DOUBLE

REAL*16

INTEGER

REAL

DOUBLE

REAL*16

AMAX0

AMAX0

INTEGER

REAL

MAX1

MAX1

REAL

INTEGER

Choosing smallest value

min(a1, a2, …)

≥2

MIN

MIN0

AMIN1

DMIN1

QMIN1 ¤

INTEGER

REAL

DOUBLE

REAL*16

INTEGER

REAL

DOUBLE

REAL*16

AMIN0

AMIN0

INTEGER

REAL

MIN1

MIN1

REAL

INTEGER