LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Major bug in LabVIEW math

Hi all,

A colleague of my found this bug.
There is a bug in LabVIEW 7.1 where if you have a for loop, a constant outside the loop and do simple math, such as subtract on a constant that resides inside the for loop it treats the top terminal as having a value of 0.

Directions

Place a for loop on the diagram, wire 1 to the count terminal Place a constant on the diagram outside the for loop, use any positive value.
Place a constant inside the for loop, use any positive value.
Subtract them with the constant outside the for loop wired to the top terminal.
Wire the result of the subtract to the output of the for loop, disable indexing.
Wire the top terminal to the output of the for loop, disable indexing.

Probe the output of
the subtract.
Run VI

I have tried add, multiple and divide. Same bad results

This has been submitted to NI as a bug report.




Dean Mills
Lead Software Developer
Meikle Automation
Software Engineering Group
tel: 519-896-1055 ext 353
fax: 519-896-0002
dmills@meikleautomation.com
www.meikleautomation.com
Message 1 of 12
(4,155 Views)
Also on MacOS.
That's a really BIG one !
Chilly Charly    (aka CC)
Message 2 of 12
(4,154 Views)
Try this. Create a while loop that will only run once with the same math function. You will see it works... then change your while loop to a for loop by right clicking. You bug has been fixed. kinda. 🙂 Thanks to Ben for helping me find this work around.
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
Message 3 of 12
(4,154 Views)
This fix doesn't seems to work on my machines (W2000 & MacOS X).
Apparently the problem has nothing to do with the fact that the loop run only once. I get it with any number of turns. It is rather related to the wiring of the upper input to the other side of the loop...
CC
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 12
(4,154 Views)
Try this example. The top loop was created as a while loop and then changed to a for loop. The bottom loop was just created normally with a for loop. Pretty neat example. Hope this helps.

Brandon Dineff
Data Science Automation
LabVIEW Certified Architect
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 5 of 12
(4,154 Views)
It works !
What didn't work in my previous trial was creating the loop as "For" (bug), then convert to "While" (no bug) and back to For (bug again).
I like very much this selective memory effect.
Now, ultimately, we have a practical mean to find out if, in a remote past, a loop was born as For or While. No way for it to hide its origin... Great !
CC
Chilly Charly    (aka CC)
0 Kudos
Message 6 of 12
(4,154 Views)
Hi,

Nice bug. It is a new one, it's not in LV7.0.

Just to let you know...

Regards,

Webe.


"damsem" wrote in message
news:506500000008000000EBF90000-1079395200000@exchange.ni.com...
> Hi all,
>
> A colleague of my found this bug.
> There is a bug in LabVIEW 7.1 where if you have a for loop, a constant
> outside the loop and do simple math, such as subtract on a constant
> that resides inside the for loop it treats the top terminal as having
> a value of 0.
>
> Directions
>
> Place a for loop on the diagram, wire 1 to the count terminal Place a
> constant on the diagram outside the for loop, use any positive value.
> Place a constant inside the for loop, use any positive value.
> Subtract them with the constant outside the for loop wired to the to
p
> terminal.
> Wire the result of the subtract to the output of the for loop, disable
> indexing.
> Wire the top terminal to the output of the for loop, disable indexing.
>
> Probe the output of the subtract.
> Run VI
>
> I have tried add, multiple and divide. Same bad results
>
> This has been submitted to NI as a bug report.
>
>
>
>
> Dean Mills
> Lead Software Developer
> Meikle Automation
> Software Engineering Group
> tel: 519-896-1055 ext 353
> fax: 519-896-0002
> dmills@meikleautomation.com
> www.meikleautomation.com
0 Kudos
Message 7 of 12
(4,154 Views)
Hi,

This happens to also other data types (not just numbers) including strings. Looks like if you pass a constant of any datatype through a for loop without enabling index on the output tunnel, then you'll get the default value on that wire passed to all sub-VIs inside the for loop.

Dan
0 Kudos
Message 8 of 12
(4,154 Views)
Hello �

We have received the bug report and our R&D group is currently investigating the problem.

We appreciate the feedback. It is through feedback such as this that we can make LabVIEW an even better product.

S Vences
Applications Engineer
National Instruments
0 Kudos
Message 9 of 12
(4,154 Views)
Hello LabVIEW Users,

Thank you for reporting this issue. Prior to 10/13/2004, National Instruments was not aware of this issue, and we apologize for any inconvenience it has caused.

We have since investigated this issue, and I would like to pass along more details about it. This issue occurs when a wire is connected to a For Loop, through the For Loop's diagram, and out the other side of the For Loop, with indexing disabled. Within the For Loop, the wire is branched to one of several operations such as Add, Subtract or Increment. When the original wire comes from a constant or a computed constant and all other wired inputs to the function are also constants or computed constants, the output of the function inside the For Loop can produce a wrong result.
The wrong result will either be the constant value itself, or the result which would be produced by the default value for that type, depending upon the operation.

While we feel that this issue should affect relatively few real-world applications, we are presently working on a longer-term solution for this, and will post more information here when it is available.

Jeff Boettcher
Product Support Engineer
National Instruments - LabVIEW R&D
Message 10 of 12
(4,154 Views)