1 |
|
2 |
|
3 | # Function ceil
|
4 |
|
5 | Round a value towards plus infinity
|
6 | If `x` is complex, both real and imaginary part are rounded towards plus infinity.
|
7 | For matrices, the function is evaluated element wise.
|
8 |
|
9 |
|
10 | ## Syntax
|
11 |
|
12 | ```js
|
13 | math.ceil(x)
|
14 | ```
|
15 |
|
16 | ### Parameters
|
17 |
|
18 | Parameter | Type | Description
|
19 | --------- | ---- | -----------
|
20 | `x` | number | BigNumber | Fraction | Complex | Array | Matrix | Number to be rounded
|
21 |
|
22 | ### Returns
|
23 |
|
24 | Type | Description
|
25 | ---- | -----------
|
26 | number | BigNumber | Fraction | Complex | Array | Matrix | Rounded value
|
27 |
|
28 |
|
29 | ## Examples
|
30 |
|
31 | ```js
|
32 | math.ceil(3.2) // returns number 4
|
33 | math.ceil(3.8) // returns number 4
|
34 | math.ceil(-4.2) // returns number -4
|
35 | math.ceil(-4.7) // returns number -4
|
36 |
|
37 | const c = math.complex(3.2, -2.7)
|
38 | math.ceil(c) // returns Complex 4 - 2i
|
39 |
|
40 | math.ceil([3.2, 3.8, -4.7]) // returns Array [4, 4, -4]
|
41 | ```
|
42 |
|
43 |
|
44 | ## See also
|
45 |
|
46 | [floor](floor.md),
|
47 | [fix](fix.md),
|
48 | [round](round.md)
|