NAME
lrint(), lrintf(), lrintl(), lrintw(), lrintq() — round to nearest long int functions
SYNOPSIS
#include <math.h>
long int lrint(double x);
HP Integrity Server Only
long int lrintf(float x);
long int lrintl(long double x);
long int lrintw(extended x);
long int lrintq(quad x);
DESCRIPTION
lrint()
rounds its argument to the nearest integral value, rounding according
to the current rounding direction.
lrint()
is equivalent to
llrint(),
except that it rounds to
long int
instead of
long long.
Integrity Server Only
lrintf()
is a
float
version of
lrint();
it takes a
float
argument.
lrintl()
is a
long double
version of
lrint();
it takes a
long double
argument.
lrintw()
is an
extended
version of
lrint();
it takes an
extended
argument.
lrintq()
is equivalent to
lrintl()
on HP-UX systems.
USAGE
To use these functions,
compile either with the default
-Ae
option or with the
-Aa
and
-D_HPUX_SOURCE
options.
To use (for Integrity servers)
lrintw()
or
lrintq(),
compile also with the
-fpwidetypes
option.
Make sure your program includes
<math.h>.
Link in the math library by specifying
-lm
on the compiler or linker command line.
For more information, see the
HP-UX floating-point guide for HP Integrity servers
at the following site:
http://www.hp.com/go/fp.
RETURN VALUE
If the rounded value is outside
the range of
long int,
the numeric result is the maximum or minimum
long int
value and the invalid floating-point
exception is raised. On Integrity servers, if the rounded value is outside
the range of
long int,
the numeric result is the minimum
long int
value.
When
lrint()
raises no other floating-point exception and the result differs from
the argument, the function raises the inexact floating-point
exception.
ERRORS
No errors are defined.
SEE ALSO
ceil(3M),
floor(3M),
fabs(3M),
fmod(3M),
fegetround(3M),
fesetround(3M),
llrint(3M),
llround(3M),
lround(3M),
rint(3M),
round(3M),
trunc(3M),
math(5),
fenv(5).
STANDARDS CONFORMANCE
lrint(),
lrintf(),
lrintl()
: ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')