This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Performing Modulo Operation in LabVIEW

Updated Aug 18, 2023

Reported In

Software

  • LabVIEW

Issue Details

I am looking for the modulo operation in LabVIEW. Where can I find this operation?

Solution

While LabVIEW does not have an explicit modulo operation, there are a variety of ways to perform modulo in LabVIEW.
  • Quotient & Remainder
​The Quotient & Remainder function is most straightforward. The Remainder output is the result of a modulo operation using truncated division. As such, Remainder has the same sign as the dividend and negative numbers are treated differently than in a traditional modulo operation.
  • ​​Formula Express VI and Formula Node
By using a Formula Express VI or Formula Node, you can type the formula for a modulo operation with two inputs and one output. This performs a traditional modulo operation

The image below shows the difference between modulo implemented in Quotient & Remainder and modulo implemented in the Formula Express VI and Formula Node.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.