Previous Page
Next Page

round

Rounds a floating-point number to an integer value

#include <math.h>
double round ( double x  );
float roundf ( float x  );
long double roundl ( long double x  );

The round( ) functions round a floating-point number to the nearest integer value, regardless of the current rounding direction setting in the floating-point environment. If the argument is exactly halfway between two integers, round( ) rounds it away from 0. The return value is the rounded integer value.

Example

See the example for nearbyint( ) in this chapter.

See Also

lround( ), llround( ), rint( ), lrint( ), llrint( ), nearbyint( ), nexttoward( ), nextafter( ); ceil( ), trunc( )


Previous Page
Next Page