Chapter Contents

Previous

Next
nearbyint

nearbyint



Convert to floating-point integer

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
USAGE NOTES
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <math.h>

   double nearbyint(double x);
   float nearbyintf(float x);
   long double nearbyintl(long double x);


DESCRIPTION

nearbyint converts its argument to an integral value using the current rounding mode, and returns it as a floating-point value. The inexact floating-point exception is not raised.

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


RETURN VALUE

nearbyint returns its argument converted to an integer.


IMPLEMENTATION

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


USAGE NOTES

For hexadecimal floating-point, the nearbyint function is identical to the rint function.


RELATED FUNCTIONS

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