Keil Logo Arm Logo

ceil

Summary
#include <math.h>

double ceil (
  double val);   /* number to calculate ceiling for */
Description

The ceil function calculates the smallest integer value that is greater than or equal to val.

Return Value

The ceil function returns a float that contains the smallest integer value that is not less than val.

See Also

floor

Example
#include <math.h>
#include <stdio.h> /* for printf */

void tst_ceil (void) {
  float x;
  float y;

  x = 45.998;
  y = ceil (x);

  printf ("CEIL(%f) = %f\n", x, y);

  /* output is "CEIL(45.998) = 46" */
}

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.