# man pages section 3: Extended Library Functions, Volume 4

Updated: Thursday, June 13, 2019

## aint (3SUNMATH)

### Name

aint, aintf, aintl, anint, anintf, anintl, irint, irintf, irintl, nint, nintf, nintl - round to integral value in floating point or integer format

### Synopsis

```cc [ flag ... ] file ...  -lsunmath -lm [ library ... ]
```
```#include <sunmath.h>
```
```double aint(double x);
```
```float aintf(float x);
```
```long double aintl(long double x);
```
```double anint(double x);
```
```float anintf(float x);
```
```long double anintl(long double x);
```
```int irint(double x);
```
```int irintf(float x);
```
```int irintl(long double x);
```
```int nint(double x);
```
```int nintf(float x);
```
```int nintl(long double x);
```

### Description

These functions round a floating point value x to one of the integers nearest x.

aint(x) returns a floating point number equal to the nearest integer no larger than x in absolute value. If x is NaN, aint(x) returns a NaN. If x is infinite or is itself an integer, aint(x) returns x. Otherwise, the result has the same sign as x. aint() is equivalent to the Fortran intrinsic function AINT(). It is also equivalent to the C99 function trunc() except that aint() always raises the inexact exception when x is not an integer while trunc() need not.

anint(x) returns a floating point number equal to the nearest integer to x; when x is exactly halfway between two integers, anint(x) returns the larger of the two in absolute value. If x is NaN, anint(x) returns a NaN. If x is infinite or is itself an integer, anint(x) returns x. Otherwise, the result has the same sign as x. anint() is equivalent to the Fortran intrinsic function ANINT(). It is also equivalent to the C99 function round() except that anint() always raises the inexact exception when x is not an integer while round() need not.

irint(x) rounds x to the nearest integer according to the current rounding direction mode and converts the result to an int. If x is NaN, infinite, or so large that the nearest integer would exceed the range of the int type, an invalid operation exception occurs.

nint(x) rounds x to the nearest integer and converts the result to an int; when x is exactly halfway between two integers, nint(x) selects the larger of the two in absolute value. If x is NaN, infinite, or so large that the nearest integer would exceed the range of the int type, an invalid operation exception occurs. nint() is equivalent to the Fortran intrinsic function NINT().

### Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
MT-Safe
Availability
system/library/math