Math Functions
Functions for arithmetic operations and numeric calculations.
Add
Adds two or more numeric values.
| Property | Value |
|---|---|
| Category | Math |
| Min Arguments | 2 |
| Returns | Highest weight numeric type |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0+ | Number to add | integer, decimal, float, money | Values to sum |
Description: Returns the sum of all arguments. The return type is promoted to the highest weight type among the inputs.
Example:
Add(10, 20, 30) → 60
Add(100.50, 50.25) → 150.75
Add(Price, Tax, Shipping) → Total
Subtract
Subtracts numeric values.
| Property | Value |
|---|---|
| Category | Math |
| Min Arguments | 2 |
| Returns | Highest weight numeric type |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0+ | Number to subtract | integer, decimal, float, money | Values to subtract |
Description: Subtracts all subsequent values from the first value: result = first - second - third - ...
Example:
Subtract(100, 30) → 70
Subtract(1000, 100, 50, 25) → 825
Subtract(GrossAmount, Tax, Discount) → NetAmount
Multiply
Multiplies numeric values.
| Property | Value |
|---|---|
| Category | Math |
| Min Arguments | 2 |
| Returns | Highest weight numeric type |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0+ | Number to multiply | integer, decimal, float, money | Values to multiply |
Description: Returns the product of all arguments.
Example:
Multiply(5, 10) → 50
Multiply(Quantity, UnitPrice) → LineTotal
Multiply(Principal, 1.05) → PrincipalWithInterest
Divide
Divides numeric values.
| Property | Value |
|---|---|
| Category | Math |
| Min Arguments | 2 |
| Returns | Highest weight numeric type |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0+ | Number to divide | integer, decimal, float, money | Values to divide |
Description: Divides the first value by subsequent values: result = first / second / third / ...
Rules:
- Divisor cannot be zero (will cause an error)
Example:
Divide(100, 4) → 25
Divide(Total, Quantity) → UnitPrice
Divide(AnnualSalary, 12) → MonthlySalary
Modulo
Returns the remainder after division.
| Property | Value |
|---|---|
| Category | Math |
| Min Arguments | 2 |
| Max Arguments | 2 |
| Returns | Same type as dividend |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0 | Dividend | integer, decimal, float, money | Number to divide |
| 1 | Divisor | integer | Number to divide by (must be positive) |
Description: Returns the remainder when dividend is divided by divisor.
Rules:
- Divisor must be a positive integer
- Result type matches the dividend's type
- Result is always non-negative
Example:
Modulo(17, 5) → 2
Modulo(100, 7) → 2
Modulo(RecordNumber, 2) → 0 or 1 (even/odd check)
Raise to Power
Raises a base number to an exponent.
| Property | Value |
|---|---|
| Category | Math |
| Min Arguments | 2 |
| Max Arguments | 2 |
| Returns | Same type as base |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0 | Base | integer, decimal, float, money | The base number |
| 1 | Exponent | integer | The power to raise to |
Description: Returns base raised to the power of exponent (base^exponent).
Rules:
- Exponent must be an integer
- Zero raised to any positive exponent is zero
- Any number raised to 0 is 1
Example:
Raise to Power(2, 3) → 8
Raise to Power(10, 2) → 100
Raise to Power(1.05, 12) → 1.795856... (compound interest)
Max Value
Returns the largest value among the arguments.
| Property | Value |
|---|---|
| Category | Math |
| Min Arguments | 1 |
| Returns | Highest weight numeric type |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0+ | Number to compare | integer, decimal, float, money | Values to compare |
Description: Returns the numerically largest value. If multiple values are equal and maximal, returns the first occurrence.
Example:
Max Value(10, 25, 15) → 25
Max Value(Price1, Price2, Price3) → highest price
Max Value(RequestedAmount, MinimumAmount) → at least minimum
Min Value
Returns the smallest value among the arguments.
| Property | Value |
|---|---|
| Category | Math |
| Min Arguments | 1 |
| Returns | Highest weight numeric type |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0+ | Number to compare | integer, decimal, float, money | Values to compare |
Description: Returns the numerically smallest value.
Example:
Min Value(10, 25, 15) → 10
Min Value(Stock, OrderQuantity) → available to ship
Min Value(CreditLimit, RequestedAmount) → approved amount
Random
Generates a random integer within a range.
| Property | Value |
|---|---|
| Category | Math |
| Min Arguments | 2 |
| Max Arguments | 2 |
| Returns | integer |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0 | Lower bound | integer | Minimum value (inclusive) |
| 1 | Upper bound | integer | Maximum value (inclusive) |
Description: Returns a random integer between lower and upper bounds (inclusive). Distribution is uniform.
Example:
Random(1, 100) → random number between 1 and 100
Random(0, 9) → random single digit
Random(1, 6) → simulates a dice roll