floor

Mathematics Functions

Gets the largest integer value less than the specified number.

double floor( double x); 

x The upper limit of the range from which floor returns the value.

Return Values

The floor of x.

Example

This example calculates various double values.

    #include <math.h>
    double floor(double x); // Explicit forward declaration 
    lr_output_message ("floor of 2.3 is %.1lf\n", floor(2.3));
    lr_output_message ("floor of 3.8 is %.1lf\n", floor(3.8));
    lr_output_message ("floor of -2.3 is %.1lf\n", floor(-2.3));
    lr_output_message ("floor of -3.8 is %.1lf\n", floor(-3.8));}
Example: Output:
Action.c(5): floor of 2.3 is 2.0
Action.c(6): floor of 3.8 is 3.0
Action.c(7): floor of -2.3 is -3.0
Action.c(8): floor of -3.8 is -4.0