|
float | add (float x, float y) |
| A simple math library providing basic arithmetic operations and advanced functions.
|
|
float | div (float x, float y) |
| Divides two numbers and returns the result as a float.
|
|
int | fact (int x) |
| Calculates factorial of a non-negative integer.
|
|
float | log (float x) |
| Calculates the natural logarithm of a number.
|
|
float | mul (float x, float y) |
| Multiplies two numbers and returns the result as a float.
|
|
float | nthrt (float x, float y) |
| Calculates the nth root of a number.
|
|
float | pow (float x, int y) |
| Raises a number to the power of an integer exponent.
|
|
float | sub (float x, float y) |
| Subtracts two numbers and returns the result as a float.
|
|
◆ add()
float mathlib.MathLib.add |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
|
static |
A simple math library providing basic arithmetic operations and advanced functions.
Adds two numbers and returns the result as a float.
- Parameters
-
x | First number |
y | Second number |
- Returns
- : Sum of x and y
- Exceptions
-
TypeError | If inputs are not float |
◆ div()
float mathlib.MathLib.div |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
|
static |
Divides two numbers and returns the result as a float.
- Parameters
-
- Returns
- : Quotient of x and y
- Exceptions
-
TypeError | If inputs are not float |
ZeroDivisionError | If y is zero |
◆ fact()
int mathlib.MathLib.fact |
( |
int |
x | ) |
|
|
static |
Calculates factorial of a non-negative integer.
- Parameters
-
- Returns
- : Factorial of x
- Exceptions
-
TypeError | If input is not int |
ValueError | If input is negative int |
◆ log()
float mathlib.MathLib.log |
( |
float |
x | ) |
|
|
static |
Calculates the natural logarithm of a number.
- Parameters
-
- Returns
- : Natural logarithm of x
- Exceptions
-
TypeError | If input is not float |
ValueError | If input is less than or equal to zero |
◆ mul()
float mathlib.MathLib.mul |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
|
static |
Multiplies two numbers and returns the result as a float.
- Parameters
-
x | First number |
y | Second number |
- Returns
- : Product of x and y
- Exceptions
-
TypeError | If inputs are not float |
◆ nthrt()
float mathlib.MathLib.nthrt |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
|
static |
Calculates the nth root of a number.
- Parameters
-
x | Radicand |
y | Degree of the root |
- Returns
- : y-th root of x as float
- Exceptions
-
TypeError | If inputs are not float |
ValueError | If y <= 0, or even root of negative number |
◆ pow()
float mathlib.MathLib.pow |
( |
float |
x, |
|
|
int |
y |
|
) |
| |
|
static |
Raises a number to the power of an integer exponent.
- Parameters
-
- Returns
- : x raised to the power y
- Exceptions
-
TypeError | If inputs are not int or float |
ValueError | If exponent is not a whole number |
◆ sub()
float mathlib.MathLib.sub |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
|
static |
Subtracts two numbers and returns the result as a float.
- Parameters
-
x | First number |
y | Second number |
- Returns
- : Difference of x and y
- Exceptions
-
TypeError | If inputs are not float |
The documentation for this class was generated from the following file: