floor
double  floor ( double x );
math.h
  cplusplus.com  

Round down value.
  Returns the largest integer that is less than or equal to x

Parameters.

x
Floating point value

Return Value.
  Floor of x.

Portability.
  Defined in ANSI-C.
  ANSI-C++ adds float and double overloaded versions of this function, with the same bahavior but being both, parameter and result, of one of these types.

Example.

/* floor example */
#include <stdio.h>
#include <math.h>

main ()
{
  printf ("floor of 2.3 is %.1lf\n", floor (2.3) );
  printf ("floor of 3.8 is %.1lf\n", floor (3.8) );
  printf ("floor of -2.3 is %.1lf\n", floor (-2.3) );
  printf ("floor of -3.8 is %.1lf\n", floor (-3.8) );
  return 0;
}
Output:
floor of 2.3 is 2.0
floor of 3.8 is 3.0
floor of -2.3 is -3.0
floor of -3.8 is -4.0

See also.
  ceil, fmod


© The C++ Resources Network, 2000