floor

Syntax:

    #include <cmath>
    double floor( double arg );

The function floor() returns the largest integer not greater than arg. For example,

     y = 6.04;
     x = floor( y );

would result in x being set to 6.0, and

     y = -6.04;
     x = floor( y );

would result in x being -7.0.

C++ also provides the following overloaded forms:

    #include <cmath>
    float floor( float arg ); // same as floorf() in C99
    long double floor( long double arg ); // same as floorl() in C99

Related Topics: ceil, fmod