Round To Nearest Function
- Updated2025-07-30
- 2 minute(s) read
Rounds the input to the nearest integer. If the value of the input is midway between two integers, the function returns the nearest even integer.
For example, if number is 1.5 or 2.5, nearest integer value is 2.
The connector pane displays the default data types for this polymorphic function.

Inputs/Outputs
number
—
number can be a scalar number, array or cluster of numbers, array of clusters of numbers, and so on.
nearest integer value
—
nearest integer value is the resulting nearest integer to number. If the input is a time stamp value, the function rounds to the nearest second. When number is in the form of a + bi, that is, when number is complex, the function returns a complex number defined by the nearest integer to the real and imaginary parts of number. The following equation defines nearest integer value: nearest integer value(x) = nearest integer value(a) + i * nearest integer value(b) |
FPGA Module Details
The following details apply when you use this object in an FPGA VI.
| Single-Cycle Timed Loop | Supported. |
| Usage | This function does not support the single-precision floating-point data type. |
| Timing | Inside single-cycle Timed Loop--When you use this function inside a single-cycle Timed Loop, the combinatorial logic delay is proportional to the number of bits in number. Outside single-cycle Timed Loop--When you use this function outside a single-cycle Timed Loop, it takes one clock cycle and uses one register. The overflow and rounding modes might impact timing. |
| Resources | This function requires FPGA resources proportional to the number of bits in number. |
Examples
Refer to the following example files included with LabVIEW.
- labview\examples\Numerics\Numeric Functions.vi
number
—
nearest integer value
—