Logand

Logand

vishshreevT578L
Advocate Advocate
931 Views
3 Replies
Message 1 of 4

Logand

vishshreevT578L
Advocate
Advocate

i have gone through the tutorials for this function but i did not understood this function.

 

This are the 3 examples 

 

(logand 7 15 3)
3

(logand 2 3 15)
2

(logand 8 3 4)
0

i dont understand here why it returned 3...2...0 

 

Can anyone make me understand why and when this function is used.

Shreev
0 Likes
Accepted solutions (1)
932 Views
3 Replies
Replies (3)
Message 2 of 4

dbroad
Mentor
Mentor

(logand 8 3 4)

8 = 1 0 0 0
4 = 0 1 0 0
3 = 0 0 1 1

 

logand is bitwise. And the columns above.

(and 1 0 0) = 0

(and 0 1 0) = 0

(and 0 0 1) = 0

(and 0 0 1) = 0

0 0 0 0 = 0

 

(logand 7 15 3)

7  =  0 0 1 1 1

15=  0 1 1 1 1

3  =  0 0 0 1 1

 

Which columns and to 1?

0 0 0 1 1 = 3

Architect, Registered NC, VA, SC, & GA.
Message 3 of 4

Kent1Cooper
Consultant
Consultant
Accepted solution

@vishshreevT578L wrote:

.... 

Can anyone make me understand why and when this function is used.


Check this out.  As you will see from replies, some found it "clear as mud," but some found it very helpful -- I hope you will be among the latter.

Kent Cooper, AIA
0 Likes
Message 4 of 4

vishshreevT578L
Advocate
Advocate
Sir,

It was a helpful article, nicely written to understand by anyone.

Thanks once again sir....
Shreev
0 Likes