Description
The ceil function rounds a given number number up to the next whole number. This means that any decimal number is rounded up to the nearest higher whole number.
Syntax
ceil(number)
Arguments
| Argument | Description |
|---|---|
number |
The number to be rounded up. |
Return Types
The function returns the next higher whole number as the result. The return value is of type number.
Examples
| Description | Example | Result |
|---|---|---|
| Positive decimal number |
ceil(4.3) |
5 |
| Positive whole number |
ceil(7) |
7 |
| Negative decimal number |
ceil(-3.8) |
-3 |
Notes
- The
ceilfunction is particularly useful when you always want to round up to the next higher whole number, regardless of the value of the decimal place. - Unlike
floor, which rounds down to the next lower whole number,ceilalways ensures rounding up.
Comments
0 comments
Please sign in to leave a comment.