Skip to content

Rounding Operation

Applies common numeric rounding to a single value. Supports floor (down), ceil (up), round (to nearest with optional decimals), and trunc (toward zero). Always outputs a float.
Preview

Usage

Use this node whenever you need to normalize or quantize a floating-point number before downstream logic (e.g., clamping values for UI display, index selection, thresholds). Choose the operation and optionally set decimals (only used by round).

Inputs

FieldRequiredTypeDescriptionExample
valueTrueFLOATThe numeric value to round. Accepted range is approximately -1e10 to 1e10.3.14159
operationTrue["floor", "ceil", "round", "trunc"]The rounding operation to apply: floor (down), ceil (up), round (nearest), trunc (toward zero).round
decimalsTrueINTNumber of decimal places for the round operation (0–10). Ignored for floor, ceil, and trunc.2

Outputs

FieldTypeDescriptionExample
resultFLOATThe rounded numeric result as a float.3.14

Important Notes

  • Decimals usage: The decimals input only affects the round operation; it is ignored for floor, ceil, and trunc.
  • Output type: Even integer-like results are returned as FLOAT (e.g., 3.0).
  • Rounding behavior: The round operation uses standard nearest rounding to the specified decimals; ties may round to the nearest even value depending on the underlying rounding behavior.
  • Value limits: Inputs are clamped to approximately -1e10 to 1e10; decimals are limited to 0–10.
  • Error fallback: On invalid operation or runtime error, the node returns 0.0.

Troubleshooting

  • Result is 0.0 unexpectedly: Ensure the operation is one of floor, ceil, round, or trunc. Check that the input value is within the allowed range.
  • Decimals seems to have no effect: Decimals only apply when operation is round. For floor, ceil, and trunc, decimals are ignored.
  • Unexpected tie rounding (e.g., 2.5): Be aware that ties may round to even; adjust your logic or add a small epsilon if a different tie strategy is needed.
  • Precision not achieved: The node limits decimals to a maximum of 10; higher precision requests will not be applied.