Max
This node returns the larger of two numbers.
The Max node compares two numeric values and outputs the maximum value.
The Max node takes two numeric inputs and returns whichever value is larger. This is useful for ensuring values don't fall below a minimum threshold or for comparison operations.
Inputs
Numbers
| Data | Description |
|---|---|
| First Number | The first number to compare (default: 0) |
| Second Number | The second number to compare (default: 0) |
Actions
| Signal | Description |
|---|---|
| Do | Triggers the maximum value calculation |
Outputs
| Data | Description |
|---|---|
| Result | The larger of the two input numbers |
| Signal | Description |
|---|---|
| Done | Triggered when the calculation is complete |
Usage
The Max node is commonly used for:
- Setting minimum thresholds or boundaries
- Comparison operations
- Data validation and sanitization
- Mathematical calculations requiring the larger value
Example Use Cases
- Value Clamping: Ensure a value doesn't go below a minimum (e.g., max(userInput, 0))
- Game Development: Calculate maximum damage, highest score, or level caps
- UI Controls: Set minimum widget sizes or positions
- Financial Logic: Compare prices, calculate maximum fees
- Data Processing: Find peak values in datasets
Examples
| First Number | Second Number | Result |
|---|---|---|
| 5 | 3 | 5 |
| -2 | -5 | -2 |
| 0 | 10 | 10 |
| 7.5 | 7.2 | 7.5 |
| -1 | 0 | 0 |
Error Handling
The node will log errors and not perform calculations if:
- Either input value is not a valid number
- Either input value exceeds the allowed range (-1 trillion to 1 trillion)
- The result would exceed the allowed range
Mathematical Properties
- Commutative: max(a, b) = max(b, a)
- Associative: max(max(a, b), c) = max(a, max(b, c))
- Identity: max(a, -∞) = a
- Idempotent: max(a, a) = a