Because ceil is a static method of Math, you always use it as Math.ceil, rather than as a method of a Math object you created (Math is not a constructor). Double ceil (double x); float ceil (float x); long double ceil (long double x); Round up value Rounds x upward, returning the smallest integral value that is not less than x. Apart from the causes already discussed, “undefined reference” may also occur because of the following reasons. #4) Wrong Project Type. When we specify wrong project types in C IDEs like the visual studio and try to do things that the project does not expect, then, we get “undefined reference”.
The Math.ceil()
function always rounds a number up to the next largest integer.
Note: Math.ceil(
returns integer 0 and does not give a null
)NaN
error.
Syntax
Parameters
x
- A number.
Return value
The smallest integer greater than or equal to the given number.
Description
Because ceil()
is a static method of Math
, you always use it as Math.ceil()
, rather than as a method of a Math
object you created (Math
is not a constructor).
Examples
Using Math.ceil()
The following example shows example usage of Math.ceil()
.
Decimal adjustment
Specifications
Specification |
---|
Unknown specification # sec-math.ceil |
Browser compatibility
BCD tables only load in the browser
See also
Ceilf
Similar topics
Undefined Reference To Symbol Ceil
8 posts views Thread by Schklerg | last post: by |
6 posts views Thread by Penguin | last post: by |
10 posts views Thread by tmeister | last post: by |
9 posts views Thread by Ronald W. Roberts | last post: by |
4 posts views Thread by Chris Davoli | last post: by |
36 posts views Thread by Phat G5 (G3) | last post: by |
4 posts views Thread by Fuzzydave | last post: by |
6 posts views Thread by dkirkdrei | last post: by |
4 posts views Thread by =?Utf-8?B?UmVuZQ?= | last post: by |
reply views Thread by Edwin.Madari | last post: by |
reply views Thread by ravipankaj | last post: by |
reply views Thread by ravipankaj | last post: by |
reply views Thread by NPC403 | last post: by |
reply views Thread by slotstar | last post: by |
7 posts views Thread by isladogs | last post: by |
1 post views Thread by selyn9507 | last post: by |
1 post views Thread by ahmedmob | last post: by |
4 posts views Thread by jackjee | last post: by |
5 posts views Thread by Bhagaban | last post: by |