ceil.md (1621B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 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 math.ceil(x, n) 15 ``` 16 17 ### Parameters 18 19 Parameter | Type | Description 20 --------- | ---- | ----------- 21 `x` | number | BigNumber | Fraction | Complex | Array | Matrix | Number to be rounded 22 `n` | number | BigNumber | Array | Number of decimals Default value: 0. 23 24 ### Returns 25 26 Type | Description 27 ---- | ----------- 28 number | BigNumber | Fraction | Complex | Array | Matrix | Rounded value 29 30 31 ### Throws 32 33 Type | Description 34 ---- | ----------- 35 36 37 ## Examples 38 39 ```js 40 math.ceil(3.2) // returns number 4 41 math.ceil(3.8) // returns number 4 42 math.ceil(-4.2) // returns number -4 43 math.ceil(-4.7) // returns number -4 44 45 math.ceil(3.212, 2) // returns number 3.22 46 math.ceil(3.288, 2) // returns number 3.29 47 math.ceil(-4.212, 2) // returns number -4.21 48 math.ceil(-4.782, 2) // returns number -4.78 49 50 const c = math.complex(3.24, -2.71) 51 math.ceil(c) // returns Complex 4 - 2i 52 math.ceil(c, 1) // returns Complex 3.3 - 2.7i 53 54 math.ceil([3.2, 3.8, -4.7]) // returns Array [4, 4, -4] 55 math.ceil([3.21, 3.82, -4.71], 1) // returns Array [3.3, 3.9, -4.7] 56 ``` 57 58 59 ## See also 60 61 [floor](floor.md), 62 [fix](fix.md), 63 [round](round.md)