Implementation status: partially implemented

Synopsis

#include <math.h>

double ceil(double x);
float ceilf(float x);
long double ceill(long double x);

Description

Rounds x upward, returning the smallest integral value that is not less than x.

Arguments:
x - a value to be rounded.

The result has the same sign as x.

If x is NaN, a NaN is returned.

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

Return value

The rounded x value.

Errors

These functions raise the inexact floating-point exception if the result differs in value from the argument.
No errors are defined.

Implementation tasks

  • NaN, ±Inf and ±0 x value handling.
  • Negative values of argument handling.
  • The return value is tested before assigning it to an integer type to avoid the undefined results of an integer overflow.
  • These functions raise the inexact floating-point exception if the result differs in value from the argument.
  • Implement ceilf() function.
  • Implement ceill() function.

Tests

======

EXAMPLES

None.