Show: Object Pascal C++
Display Preferences

ceil, ceill

From Appmethod Topics
Jump to: navigation, search

Go Up to math.h Index


Header File

math.h

Category

Math Routines

Prototype

double ceil(double x);

long double ceill(long double x);

Description

Rounds up.

ceil finds the smallest integer not less than x.

ceill is the long double version; it takes a long double argument and returns a long double result.

Return Value

These functions return the integer found as a double (ceil) or a long double (ceill).

Example

  #include <math.h>
  #include <stdio.h>
  int main(void)
  {
     double number = 123.54;
     double down, up;
     down = floor(number);
     up = ceil(number);
     printf("original number     %5.2lf\n", number);
     printf("number rounded down %5.2lf\n", down);
     printf("number rounded up   %5.2lf\n", up);
     return 0;
  }

Portability

POSIX Win32 ANSI C ANSI C++

ceil

+

+

+

+

ceill

+

+

+

Personal tools
In other languages