floor
Computes the largest integer not greater than the argument
#include <math.h>
double floor (
double x);
The floor function computes the largest integer not greater than x, expressed as a double type.
The floor function computes the largest integer not greater than x.
#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