rint()

Rounds off to an integral value.

  #include <math.h>
  
  double rint(double x);
  
  float rintf(float x);
  
  long double rint(long double x);    
Parameter

x

The value to be compued.

Remarks

These functions round x to an integral value in floating-point format using the current rounding direction.

This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.

Listing: Example of rint() Usage

#include <math.h>

#include <stdio.h>

int main(void)

{

double x = 2.5;

printf("rint(%f) = %f\n", x, rint(x));

return 0;

}

Output:

rint(2.500000) = 2.000000