Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

floor(3M)

aint(3M)

NAME

aint, anint, irint, nint − round to integral value in floating-point or integer format

SYNOPSIS

cc [ flag ... ] file ... −lsunmath -lm [ library ... ]

#include <sunmath.h>

double aint(double x);

double anint(double x);

int irint(double x);

int nint(double x);

DESCRIPTION

aint() and anint() convert a double value into an integral value in double format.  They differ in how they choose the result when the argument is not already an integral value.  Here an “integral value” means a value of a mathematical integer, which however might be too large to fit in a particular computer’s int format.  All sufficiently large values in a particular floating-point format are already integral; in IEEE double-precision format, that means all values >= 2∗∗52.  Zeros, infinities, and quiet NaNs are treated as integral values by these functions, which always preserve their argument’s sign. 

aint() returns the integral value between x and 0, nearest x. This corresponds to IEEE rounding toward zero and to the Fortran generic intrinsic function aint. 

anint() returns the nearest integral value to x, except halfway cases are rounded to the integral value larger in magnitude. This corresponds to the Fortran generic intrinsic function anint. 

irint() converts x into int format according to the current IEEE rounding direction. 

nint() converts x into int format rounding to the nearest int value, except halfway cases are rounded to the int value larger in magnitude.  This corresponds to the Fortran generic intrinsic function nint. 

SEE ALSO

floor(3M)

SunOS WorkShop_5.0  —  Last change: 1 Sep 1993

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026