`floor`

, `floorf`

, `ceil`

, `ceilf`

---floor and ceiling#include <math.h> double floor(doublex); float floorf(floatx); double ceil(doublex); float ceilf(floatx);

**Description**

`floor`

and `floorf`

find
the nearest integer less than or equal to `x`.
`ceil`

and `ceilf`

find
the nearest integer greater than or equal to `x`.

**Returns**

`floor`

and `ceil`

return the integer result as a double.
`floorf`

and `ceilf`

return the integer result as a float.

**Portability**

`floor`

and `ceil`

are ANSI.
`floorf`

and `ceilf`

are extensions.

Go to the first, previous, next, last section, table of contents.