Skip to content

Rounding Operation

Performs numeric rounding on a single value. Supports floor, ceil, standard rounding to a specified number of decimal places, and truncation toward zero. Always returns a floating-point result.
Preview

Usage

Use this node when you need to transform a numeric value to a rounded form for downstream logic, formatting, or thresholding. Typical flows include cleaning sensor outputs, preparing values for display, or enforcing numeric constraints before comparisons.

Inputs

FieldRequiredTypeDescriptionExample
valueTrueFLOATThe numeric value to be rounded. Accepted range is approximately -1e10 to 1e10.3.14159
operationTrue['floor', 'ceil', 'round', 'trunc']The rounding method to apply. 'floor' rounds down, 'ceil' rounds up, 'round' rounds to nearest with optional decimals, 'trunc' removes the fractional part toward zero.round
decimalsTrueINTNumber of decimal places to round to. Used only when operation is 'round'. Valid range is 0–10.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'.
  • Return type: The node always returns a FLOAT, even when the mathematical result is an integer (e.g., 3.0).
  • Rounding behavior: 'round' uses standard rounding with ties-to-even behavior (banker's rounding) when exactly between two values.
  • Bounds: Inputs outside the range [-1e10, 1e10] are not accepted by the UI constraints.
  • Error handling: If an unknown operation is provided or an error occurs, the node returns 0.0.

Troubleshooting

  • Unexpected 0.0 output: Ensure 'operation' is one of ['floor', 'ceil', 'round', 'trunc'] and 'value' is a valid number.
  • Decimals not applied: Confirm 'operation' is set to 'round'; other operations ignore the 'decimals' input.
  • Tie rounding differs from expectations: For .5 cases, 'round' uses ties-to-even. If you need always-round-half-up, consider adjusting the value before rounding.
  • Result is float instead of int: This is by design. If an integer is needed, convert downstream as appropriate.