HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

r
round(3M) round(3M)
NAME
round(), roundf(), roundl(), roundw(), roundq() - round functions
SYNOPSIS
#include <math.h>
double round(double x);
Itanium(R)-based System Only
float roundf(float x);
long double roundl(long double x);
extended roundw(extended x);
quad roundq(quad x);
DESCRIPTION
The round() function rounds its argument to the nearest integral value in floating-point format. An
argument exactly halfway between two integers is rounded away from zero, regardless of the current
rounding direction. Rounding away from zero also applies to the functions, lround and llround.
Itanium-based System Only
roundf() is a float version of round(); it takes a float argument and returns a float
result.
roundl() is a long double version of round(); it takes a long double argument and returns
a
long double result.
roundw() is an extended version of round(); it takes an extended argument and returns an
extended result.
roundq() is equivalent to roundl() 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 Itanium-based systems)
roundw() or roundq(), compile also with the -fpwidetypes
option.
To use these functions, make sure your program includes
<math.h>. Link in the math library by specify-
ing -lm on the compiler or linker command line.
For more information, see the HP-UX Floating-Point Guide.
RETURN VALUE
If x is ±INFINITY or ±zero,
round() returns x.
If x is NaN, round() returns NaN.
round() may raise the inexact exception if x is non integral and finite.
ERRORS
No errors are defined.
SEE ALSO
ceil(3M), floor(3M), fabs(3M), fmod(3M), fegetround(3M), fesetround(3M), lrint(3M), llrint(3M), lround(3M),
llround(3M), rint(3M), trunc(3M), math(5), fenv(5).
STANDARDS CONFORMANCE
round(), roundf() , roundl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-
metic’’)
326 Hewlett-Packard Company 1 HP-UX 11i Version 2: December 2007 Update