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.

Note Note IEEE standards determine the rounding method for this function. This method produces more accurate values with no positive or negative bias because it does not round all integers in the same direction.

The connector pane displays the default data types for this polymorphic function.


icon

Inputs/Outputs

  • cdbl.png number

    number can be a scalar number, array or cluster of numbers, array of clusters of numbers, and so on.

  • idbl.png 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.

    Note The following details are subject to change with each version of the LabVIEW FPGA Module.
    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