Chapter Contents

Previous

Next
lround

lround



Round floating-point to long integer

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <math.h>

   long lround(double x);
   long lroundf(float x);
   long lroundl(long double x);


DESCRIPTION

lround rounds its argument to the nearest integral value and returns it as a long integer. If two results are equally near, lround rounds away from zero.

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


RETURN VALUE

lround returns its argument rounded to the nearest integer.


IMPLEMENTATION

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


RELATED FUNCTIONS

ceil, floor, llrint, llround, lrint, nearbyint, rint, round, 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.