math

ceil(x: int, decimals: int) int

Return the ceiling of x given the amount of decimals. This is the smallest integer >= x.

>>> ceil(12345, 3)
13000
Parameters:
  • x (int) – any integer number

  • decimals (int) – number of decimals

Returns:

the ceiling of x

Return type:

int

Raises:

Exception – raised when decimals is negative.

floor(x: int, decimals: int) int

Return the floor of x given the amount of decimals. This is the largest integer <= x.

>>> floor(12345, 3)
12000
Parameters:
  • x (int) – any integer number

  • decimals (int) – number of decimals

Returns:

the floor of x

Return type:

int

Raises:

Exception – raised when decimals is negative.

sqrt(x: int) int

Gets the square root of a number.

>>> sqrt(1)
1
>>> sqrt(10)
3
>>> sqrt(25)
5
Parameters:

x (int) – a non-negative number

Returns:

the square root of a number

Return type:

int

Raises:

Exception – raised when number is negative.