Mega Code Archive

 
Categories / C / Code Snippets
 

Returns the value of arg rounded to the nearest integer

//Declaration: float nearbyintf(float arg); double nearbyint(double arg); long double nearbyintl(long double arg); #include <math.h> #include <stdio.h> int main(void) { double f; f = nearbyint (3.3); printf("%f " , f); } /* 3.000000 */