Divide
Description
Pure function returning a divided by b. Integer division truncates toward zero. Decimal division uses IEEE 754 decimal64 precision (16 significant digits). Dividing by zero fails the pipeline.
When to use
Use Divide to split a total into equal parts, compute a ratio, or scale down a value.
Both integer and decimal inputs are accepted. Integer division truncates the result —
use Modulo alongside it to recover the remainder if needed. For precise fractional
results, wire decimal values instead. Guard against a zero divisor by routing through a
Greater than? check first, since a zero value in b will fail the pipeline immediately.
Pins
Input pins
| Pin | Type | Default | Notes |
|---|---|---|---|
| A | generic(integer, decimal) | 0 | The dividend. |
| B | generic(integer, decimal) | 1 | The divisor. Must not be zero — a zero value fails the pipeline. |
Output pins
| Pin | Type | Notes |
|---|---|---|
| Result | generic(integer, decimal) | The quotient of a divided by b. Integer division truncates toward zero; decimal division uses full precision. |
Example
Split a pool of credits evenly across a number of users. First verify the user count
is non-zero by wiring it into the A input of Greater than? (B set to 0) and routing
through Branch. On the True execution path, wire the total credits and user count into
the A and B inputs of Divide and pass the Result output to Log message (via Integer to
string or Decimal to string) to confirm the per-user share.