Tuesday, September 23, 2008

LabVIEW Shipping Examples

There is a shipping example with LabVIEW, Parse Arithmetic Expression.vi, that DOES NOT WORK!

Today I found an expression A+B*(C/D)+E*(F/G)+H*(I/J). The example VI does not correctly evaluate this expression.

Granted, the parenthesis are not really appropriately placed in this expression, but still, the evaluator doesn't work. It does all the divisions inside the parenthesis correctly, but then it evalues all the * and + operators in order from back to front, disregarding order of operations. This scrambles all the operator-operand relationships and gives the wrong result. Essentially, B ends up multiplying the rest of C through J.

I am just thankful that A, B, and H were all zero while E was non-zero, so that this function evaulating to zero raised a red flag to my customer. So now I have to either fix the example or restrict the expression syntax.

That's the thing when you use built-in shipping examples. You sort of just assume that they work.

No comments: