LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange behaviour of "And array Elements"

If u connect an empty boolean array to "And Array Elements" function, The output is "True" !. Is this correct?. Is there something wrong ?. Please Help.
0 Kudos
Message 1 of 6
(4,710 Views)
Hi J.A.C

This is correct.This is an explanation I've found: "This behavior is intentiional, and stems from elementary Boolean logic. The Boolean algebra primitives are analogous to numeric operations are integers. Just as the identity element for addition is 0, and for multiplication, 1; the identity for Boolean OR is FALSE, and for AND, TRUE. For example, x^0 == 1; that is, x times itself zero times is by definition 1. For the same reason boolean x ANDed with itself zero times is TRUE."

If this is not acceptable for your application, then just use the "Array Size" VI first to check if you've an empty Array (Array size=0) and then you can pass or not the array to the "And Array Elements" function.

Hope this helps.

Luca
Regards,
Luca
Message 2 of 6
(4,709 Views)
Hi J.A.C,

TRUE is the identity for the Boolean AND operation, just as 1 is the identity for the multiplication operation. You get this answer for the same reason that any number to the zero power is 1. This behavior is intentional, and stems from elementary Boolean logic. The Boolean algebra primitives are analogous to numeric operations are integers. Just as the identity element for addition is 0, and for multiplication, 1; the identity for Boolean OR is FALSE, and for AND, TRUE. For example, x^0 == 1; that is, x times itself zero times is by definition 1. For the same reason boolean x ANDed with itself zero times is TRUE. The documentation for this function should get changed to make this clear.

Hope this helps,

Nick
Message 3 of 6
(4,710 Views)
Hi Nick,

God save the "Support Portal"! 😉

Greetings from Switzerland.

Luca
Regards,
Luca
0 Kudos
Message 4 of 6
(4,709 Views)
Hey both of u'll have same answer !! and whats the support portal ? i am new ro this group (but old to LV). Thanx Anyway.
0 Kudos
Message 5 of 6
(4,709 Views)
Hi J.A.C

We both have the same answer 'cos were both NI. The support portal is our internal support site.

Hi Luca greetings from UK.

Nick
0 Kudos
Message 6 of 6
(4,710 Views)