Round

This function block rounds a numeric value to a specified number of decimal places. It is a simple numerical utility useful for formatting measurement results, counts, percentages and any numeric outputs prior to display, logging or export.

πŸ“₯ Inputs

Number The numeric value to be rounded. (Socket: Number)

πŸ“€ Outputs

Number The rounded numeric value. (Socket: Number)

πŸ•ΉοΈ Controls

Decimals Sets how many decimal places the input number will be rounded to. Enter an integer (for example 0, 1, 2).

🎨 Features

  • Simple visual control for selecting decimal precision using a text field.

  • Instantly converts any incoming numeric socket value into a nicely formatted numeric value for display, plotting or export.

  • Useful to reduce noise in displayed metrics (e.g., shorten long floating point values).

πŸ“ Usage Instructions

  1. Provide a numeric value to the Number input socket (for example a measurement or a count).

  2. Set the desired precision using the Decimals control.

  3. Read the rounded result from the Number output socket and pass it to display, logging or further processing blocks.

πŸ“Š Evaluation

When evaluated, this function block takes the current numeric input and returns the same value rounded to the number of decimals specified in the Decimals control.

πŸ’‘ Tips and Tricks

  • When showing statistics from image analysis, round numeric outputs from blocks such as Mean Value of Image or Std. of Image to make dashboards and reports easier to read.

  • Round distance values from Measure Position Distance before sending them to displays or logs to avoid overly precise values that are hard to interpret.

  • If you want to store compact numeric logs or CSV files, round values before feeding them to CSV Export or Data to JSON.

  • For visual plots, feed rounded numbers into Scope to make plotted labels and legends clearer.

  • If a detection block returns counts (for example from Object Detection or Object Detection - Custom), use this block to format numbers for UIs or records.

πŸ› οΈ Troubleshooting

  • If the output does not change as expected, check that the Number input is receiving a valid numeric value. Use Is None or Replace None to handle missing inputs before rounding.

  • If non-integer values are entered into the Decimals control, ensure you provide a valid integer value; otherwise the control may be interpreted in an unexpected way.

Last updated

Was this helpful?