Skip to main content

Round

This node rounds a number to the nearest integer.

The Round node performs standard mathematical rounding.

The Round node takes a numeric input and rounds it to the nearest integer. Values with a fractional part of .5 or greater round up, while less than .5 round down. For example, 4.5 becomes 5, 4.4 becomes 4.

Inputs​

Input​

DataDescription
ValueThe number to round. Default: 0.

Actions​

SignalDescription
DoTriggers the calculation. The result is updated only when this signal is received.

Outputs​

Data​

DataDescription
Rounded ValueThe rounded integer result.

Signals​

SignalDescription
DoneTriggered when the calculation is successfully completed.

Usage​

Use this node for general-purpose rounding where you want the closest whole number.

Example Use Cases​

  1. UI Display: Showing a clean integer score instead of a float.
  2. Snapping: Snapping an object position to the nearest grid line.
  3. Statistics: Rounding averages to whole numbers.

Detailed Behavior​

  1. Validation:
    • Input must be a valid number.
    • Input and Result must be within ±1,000,000,000,000.
  2. Calculation:
    • Uses Math.round().
    • Triggered only by the Do signal.
  3. Error Handling:
    • If the result exceeds the allowed range, an error is logged and Done is not signaled.

Troubleshooting​

  • Midpoint Rounding: Math.round() rounds .5 up towards positive infinity. -4.5 becomes -4, and 4.5 becomes 5.