Implementation status: partially implemented

Synopsis

#include <math.h>

double floor(double x);
float floorf(float x);
long double floorl(long double x);

Description

Rounds x downward, returning the largest integral value that is not greater than x.

Arguments:
x - the value of which the largest integral value is computed.

The return value should be tested before assigning it to an integer type to avoid the undefined results of an integer overflow.

Return value

Upon successful completion, these functions return the largest integral value not greater than x, expressed as a double, float, or long double, as appropriate for the return type of the function.
The result has the same sign as x.

If x isNaN, a NaN is returned.

If x is ±0 or ±Inf, x is returned.

Errors

No errors are defined.

Implementation tasks

  • Implement the floorf() function.
  • Implement the floorl() function.