RAD Studio |  |

ceil, ceill

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

Copy Code

     #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 |  | + | + | +

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!