Ceiling Function C
C ceil prototype.
Ceiling function c. Ceil function for double float and long double types. Additional overloads are provided in this header cmath for the integral types. Rounds up the nearest integer.
Following is the declaration for ceil function. The function is defined in math h header file. Header tgmath h provides a type generic macro version of this function.
Ceiling decimal returns the smallest integral value that is greater than or equal to the specified decimal number. If 2 3 is passed to ceil it will return 3. Long double ceill long double arg.
Float ceilf float arg. In order to find the ceil of long double or float you can use the above prototype. For example if you want to avoid using pennies in your prices and your product is priced at 4 42 use the formula ceiling 4 42 0 05 to round prices up to the nearest nickel.
Returns number rounded up away from zero to the nearest multiple of significance. You can look at the example given below for more clarification. Double ceil double x parameters.
X this is the floating point value. Double ceil double arg. In mathematics and computer science the floor and ceiling functions map a real number to the greatest preceding or the least succeeding integer respectively.