Skip to content

Rounding Operation

Applies a rounding function to a numeric value. Supports floor, ceil, round (with configurable decimal places), and truncation toward zero. Returns the result as a float and clamps behavior is consistent across operations.
Preview

Usage

Use this node whenever you need to normalize or discretize numeric values for downstream nodes, such as converting continuous outputs to fixed precision, enforcing integer-like values, or simplifying values for thresholds and comparisons. Typical in data preparation, control flows, and formatting numeric outputs.

Inputs

FieldRequiredTypeDescriptionExample
valueTrueFLOATThe numeric value to be processed. Accepted range is approximately -1e10 to 1e10.3.14159
operationTrueSTRING (enum)The rounding operation to perform. One of: floor, ceil, round, trunc.round
decimalsTrueINTNumber of decimal places used only when operation is 'round'. Ignored for floor, ceil, and trunc. Range 0–10.2

Outputs

FieldTypeDescriptionExample
resultFLOATThe rounded result as a float.3.14

Important Notes

  • Decimals is only applied when operation is 'round'; it is ignored for 'floor', 'ceil', and 'trunc'.
  • Output is always a float, even when the result is an integer (e.g., floor(5.9) returns 5.0).
  • If an unknown operation is provided or an error occurs, the node returns 0.0.
  • Input constraints: value ~[-1e10, 1e10], decimals [0, 10].
  • Trunc truncates toward zero (e.g., -3.7 -> -3.0).

Troubleshooting

  • Result is 0.0 unexpectedly: Ensure 'operation' is one of floor, ceil, round, trunc and that 'value' is a valid number.
  • Decimals not affecting the result: Confirm the operation is 'round'; other operations ignore 'decimals'.
  • Unexpected sign behavior with negatives: Remember 'trunc' moves toward zero; use 'floor' for negative values to round down (more negative).
  • Precision concerns when rounding: For binary floating-point values, slight representation errors may occur; adjust 'decimals' or pre-scale if exact decimal rounding is critical.