Name
round
Synopsis
Rounds a floating-point number to an integer value
#include <math.h> doubleround
( doublex
); floatroundf
( floatx
); long doubleroundl
( long doublex
);
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()
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.