LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Quotient and Remainder with Negative numbers?

Is the Quotient and Remaider function supposed to work with negative numbers?

 

-1 divided by 5 returns a quotient of -1 and a remainder of +4.....I expected Q=0 and R= -1

-6 divided by 5 returns Q= -2 and R = +4....I expected Q=-1 and R = -1

 

Is this a bug or a misunderstanding of how the Q & R function works?

0 Kudos
Message 1 of 3
(3,320 Views)

Those results are consistent with the way the function is defined.  See the context help for the formulas.

 

Lynn 

0 Kudos
Message 2 of 3
(3,316 Views)

The definition and result differ in various programming language, see for example this article.

 

Personally, I prefer the LabVIEW interpretation for many reasons. 🙂

Message 3 of 3
(3,309 Views)