Intel® Fortran Compiler 16.0 User and Reference Guide

AINT

Elemental Intrinsic Function (Generic): Truncates a value to a whole number.

result = AINT (a [,kind])

a

(Input) Must be of type real.

kind

(Input; optional) Must be a scalar integer initialization expression.

Results

The result type is real. If kind is present, the kind parameter of the result is that specified by kind; otherwise, the kind parameter is that of a.

The result is defined as the largest integer whose magnitude does not exceed the magnitude of a and whose sign is the same as that of a. If | a | is less than 1, AINT( a) has the value zero.

Specific Name

Argument Type

Result Type

AINT 1

REAL(4)

REAL(4)

DINT 1

REAL(8)

REAL(8)

QINT

REAL(16)

REAL(16)

1 The setting of compiler options specifying real size can affect AINT and DINT.

To round rather than truncate, use ANINT.

Example

AINT (3.678) has the value 3.0.

AINT (-1.375) has the value -1.0.

REAL r1, r2
REAL(8) r3(2)
r1 = AINT(2.6)   ! returns the value 2.0
r2 = AINT(-2.6)  ! returns the value -2.0
r3 = AINT((/1.3, 1.9/), KIND = 8)       ! returns the values
                                        ! (1.0D0, 1.0D0)

See Also