anint

Date:

10-12-2011

NAME

ANINT, DNINT - Find nearest whole number

SYNOPSIS

ANINT ([A=]a [[,KIND=]kind])
DNINT ([A=]a)

STANDARDS

Fortran

DESCRIPTION

ANINT is the generic function name; ANINT is specific. These are elemental intrinsic functions that accept the following arguments:

a

Must be type single-precision real or double-precision real. See the RETURN VALUES section for information on input data types and return values.

kind

A scalar integer initialization expression. Must be a kind type allowed for a.

NOTES

The ANINT and DNINT intrinsic function names can be passed as argumentst.

RETURN VALUES

ANINT returns the real nearest whole number for its real argument, as follows:

  • If a >= 0, the result is REAL(INT(a+ 0.5)).

  • If a < 0, the result is REAL(INT(a- 0.5)).

If KIND is present, the kind type parameter is that specified by the value of KIND; otherwise, the kind type parameter is that of A.

DNINT returns the double-precision nearest whole number for its double-precision argument.

EXAMPLES

The following examples show the results of calling ANINT with positive and negative arguments:

  • ANINT(3.7) yields 4.0.

  • ANINT(-3.7) yields -4.0.

SEE ALSO

aint(3i)