LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Min & Max bug?

Solved!
Go to solution

Hi all,

 

I have observed strange behavior in the min & Max node in the snippet below. It is set to compare elements. Depending on the array size as determined by "Dimension" the resulting y array for "Signal" yields different results.

It is supposed to read:

 

NaN,1,1,1,2,2,2,NaN,...

 

But when I enter a value for "Dimension" of 16 or greater it reads:

 

NaN,NaN,NaN,NaN,2,2,2,NaN,...

 

For smaller values of "Dimension" the snippet works as intended.

Using probes it seems that min(NaN;x)=x for Arrays with 15 elements and less and for larger arrays it's min(NaN;x)=NaN

Surely this is not intended

 

I guess I'm missing something obvious and am about to learn something. Smiley Happy

Or is this really a bug?

Using LV 2011 SP1

 

 

MinMaxOddity.png

 

Regards

Florian

0 Kudos
Message 1 of 9
(2,976 Views)

Hi Florian,

 

such a bug has been reported before. It gives wrong results for arrays with a certain size (16 elements minimum)...

 

Sorry, too lazy to search this in the forum on my own. 😉

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(2,966 Views)

Thanks for answering.

 

I did a quick forum search before posting, and have tried again (with more effort Smiley Wink) after reading your post.

I can't find anything though.

Nothing here

http://www.ni.com/white-paper/13164/%29

either.

 

Regards Florian

0 Kudos
Message 3 of 9
(2,957 Views)

Hi Florian,

 

I too can't find that at the moment. But I remember some strange compiler problems for arrays of certain size (16 elements was the "barrier" I think).

 

Maybe someone else can remember the corresponding CAR or link...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 9
(2,931 Views)

For what it's worth it's doing it in LV2012 also.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 9
(2,916 Views)
Solution
Accepted by topic author Florian.Ludwig

A workaround for your problem is to put a for loop around the compare.  It will give consistent results.

 

What I find interesting is that the result for arrays larger than 16 elements is the same as if you compare aggregates.

 

This also appearss to be specific to NaN.  If you use a different value for your array, you don't see the value change.

 

I can also confirm the same behavior in LV2012.

Message 6 of 9
(2,911 Views)

Thanks,

 

that's the workaround that I came to implement too.

 

Regards Florian

0 Kudos
Message 7 of 9
(2,907 Views)

Just tried it in LV2009 also and it worked as expected.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 8 of 9
(2,895 Views)

This has been reported and has a new CAR #385324.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 9 of 9
(2,853 Views)