Chapter Contents

Previous

Next
lrint

lrint



Convert floating-point to long integer

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <math.h>

   long lrint(double x);
   long lrintf(float x);
   long lrintl(long double x);


DESCRIPTION

lrint uses the current rounding mode to convert its argument to an integral value and returns it as a long integer.

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


RETURN VALUE

lrint returns its argument converted to a long integer. If the result is outside the range of long integer, the return value is unpredictable.


IMPLEMENTATION

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


RELATED FUNCTIONS

ceil, floor, llrint, llround, lround, 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.