floor

Computes the largest integer not greater than the argument

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:Mathematical Computation

Syntax

  #include <math.h>  
   
  double floor  ( 
     double   x);
  

Parameters

x
(IN) Specifies an argument.

Return Values

The floor function computes the largest integer not greater than x, expressed as a double type.

Remarks

The floor function computes the largest integer not greater than x.

See Also

ceil, fmod

Example

  #include <math.h>  
  #include <stdio.h>  
   
  main ()  
  {  
     printf ("%f\n", floor (-3.14) );  
     printf ("%f\n", floor (-3.) );  
     printf ("%f\n", floor (0.) );  
     printf ("%f\n", floor (3.14) );  
     printf ("%f\n", floor (3.) );  
  }
  

produces the following:

  -4.000000  
  -3.000000  
   0.000000  
   3.000000  
   3.000000