UNPKG

1.57 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function ceil
4
5Round a value towards plus infinity
6If `x` is complex, both real and imaginary part are rounded towards plus infinity.
7For matrices, the function is evaluated element wise.
8
9
10## Syntax
11
12```js
13math.ceil(x)
14math.ceil(x, n)
15```
16
17### Parameters
18
19Parameter | Type | Description
20--------- | ---- | -----------
21`x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix | Number to be rounded
22`n` | number &#124; BigNumber &#124; Array | Number of decimals Default value: 0.
23
24### Returns
25
26Type | Description
27---- | -----------
28number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix | Rounded value
29
30
31## Examples
32
33```js
34math.ceil(3.2) // returns number 4
35math.ceil(3.8) // returns number 4
36math.ceil(-4.2) // returns number -4
37math.ceil(-4.7) // returns number -4
38
39math.ceil(3.212, 2) // returns number 3.22
40math.ceil(3.288, 2) // returns number 3.29
41math.ceil(-4.212, 2) // returns number -4.21
42math.ceil(-4.782, 2) // returns number -4.78
43
44const c = math.complex(3.24, -2.71)
45math.ceil(c) // returns Complex 4 - 2i
46math.ceil(c, 1) // returns Complex 3.3 - 2.7i
47
48math.ceil([3.2, 3.8, -4.7]) // returns Array [4, 4, -4]
49math.ceil([3.21, 3.82, -4.71], 1) // returns Array [3.3, 3.9, -4.7]
50```
51
52
53## See also
54
55[floor](floor.md),
56[fix](fix.md),
57[round](round.md)