10-08-2008 11:59 AM
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?
10-08-2008 12:13 PM
Those results are consistent with the way the function is defined. See the context help for the formulas.
Lynn
10-08-2008 12:23 PM
The definition and result differ in various programming language, see for example this article.
Personally, I prefer the LabVIEW interpretation for many reasons. 🙂