-
Notifications
You must be signed in to change notification settings - Fork 0
Arithmetic
github-actions[bot] edited this page Jan 24, 2024
·
2 revisions
Arithmetic module for basic arithmetic operations.
▸ add(x
, y
): number
Adds two numbers.
Name | Type | Description |
---|---|---|
x |
number |
The first number. |
y |
number |
The second number. |
number
The sum of the two numbers.
Example
// Return 2:
add(1, 1);
Example
// Return 4:
add(3, 1);
▸ div(x
, y
): number
Divides two numbers.
Name | Type | Description |
---|---|---|
x |
number |
The first number. |
y |
number |
The second number. |
number
The quotient of the two numbers.
Example
// Return 1:
div(1, 1);
Example
// Return 3:
div(3, 1);
Example
// Return -0.3333333333333333:
div(1, -3);
▸ mul(x
, y
): number
Multiplies two numbers.
Name | Type | Description |
---|---|---|
x |
number |
The first number. |
y |
number |
The second number. |
number
The product of the two numbers.
Example
// Return 1:
mul(1, 1);
Example
// Return 3:
mul(3, 1);
Example
// Return -3:
mul(1, -3);
▸ sub(x
, y
): number
Subtracts two numbers.
Name | Type | Description |
---|---|---|
x |
number |
The first number. |
y |
number |
The second number. |
number
The difference of the two numbers.
Example
// Return 0:
sub(1, 1);
Example
// Return 2:
sub(3, 1);
Example
// Return -2:
sub(1, 3);