Chapter Contents

Previous

Next
round

round



Round to floating-point integer

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <math.h>

double round(double x);
float roundf(float x);
long double roundl(long double x);


DESCRIPTION

round rounds its argument to the nearest integral value, and returns it as a floating-point value. If two results are equally near, round rounds away from zero.

The function name roundf should be used for float arguments, and roundl for long double arguments. Alternately, if the header file tgmath.h is included, round may be used with any numeric argument type.


RETURN VALUE

round returns its argument, rounded to the nearest integer.


IMPLEMENTATION

round is implemented as a built-in function unless it is undefined by a #undef statement.


RELATED FUNCTIONS

ceil, floor, llrint, llround, lrint, lround, nearbyint, rint, trunc


SEE ALSO

"Mathematical Functions" in Chapter 2, "Function Categories"


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.