Name

llround

Synopsis

Rounds a floating-point number to a long long integer

#include <math.h>
long longllround( double x );
long long llroundf( float x );
long long llroundl( long double x );

The llround() functions are like lround(), except that they return an integer of type long long. llround() rounds a floating-point number to the nearest integer value. A value halfway between two integers is rounded away from zero. If the result is outside the range of long long, a range error may occur (this is implementation-dependent), and the return value is unspecified.

Example

See the example for lround() in this chapter.

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.