C/math.h/nearbyint

Материал из C\C++ эксперт
Перейти к: навигация, поиск

nearbyint: returns the value of arg rounded to the nearest integer

<source lang="cpp">

//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 (2.3);
   
    printf("%f " , f);
 }
        
       /*
       2.000000
       */ 
          
      </source>