ceil()

Declaration

double ceil(double dX);

Description:

This function returns the ceiling or smallest integer that is greater than or equal to the passed-in argument.

Overloads

float ceil(float);
double ceil(double);
long double ceil(long double);

Related Functions

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

* Note: Since C does not allow function overloading, these other versions of this function exist.

Domain

(-∞, ∞)

Range

Integers

Periodicity

None

Symmetry

None

Asymptotes

None





Example

#include <iostream>
#include <cmath>

int main() {
    using namespace std;

    double dX = -1000.0;
    cout << "x = " << dX << "  ceil(x) = " << ceil(dX) << endl;

    dX = 1.8;
    cout << "x = " << dX << "  ceil(x) = " << ceil(dX) << endl;

    return 0;
}

Output:

ceil() Output