[UP]


Manual Reference Pages  - anint (3)

NAME

anint(3f) - [FORTRAN:INTRINSIC:NUMERIC] Nearest whole number

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class

SYNTAX

result = anint(a [, kind])

DESCRIPTION

anint(a [, kind]) rounds its argument to the nearest whole number.

ARGUMENTS

A - the type of the argument shall be REAL.
KIND - (optional) an INTEGER initialization expression indicating the kind parameter of the result.

RETURN VALUE

The return value is of type real with the kind type parameter of the argument if the optional KIND is absent; otherwise, the kind type parameter will be given by KIND. If A is greater than zero, anint(a) returns aint(x + 0.5). If A is less than or equal to zero then it returns aint(x - 0.5).

EXAMPLE

Sample program:

    program demo_anint
      real(4) x4
      real(8) x8
      x4 = 1.234E0_4
      x8 = 4.321_8
      print *, anint(x4), dnint(x8)
      x8 = anint(x4,8)
    end program demo_anint

STANDARD

[[FORTRAN 77]] and later

CLASS

[[Elemental procedure|Elemental function]]


anint (3) March 18, 2019
Generated by manServer 1.08 from 00f2f5bf-86c4-4b56-9fbb-4dfd8a50f1f1 using man macros.