Double condition Boolean

DSP related issues, mathematics, processing and techniques
Post Reply
Tepeix
Posts: 361
Joined: Sat Oct 16, 2021 3:11 pm

Double condition Boolean

Post by Tepeix »

Hi
I just find this code line that i didn't know was possible.

X = (a<b)|(b<c);

With this X will be true if b<a or b>c.
Or false only if a<b<c.

Which is the contrary of what i expected...

Did you know a way to make an inverted result or what is supposed to do the | ?
Or another way to make double condition boolean ?

Thanks for any response !)
Attachments
Double conditional Bolean.fsm
(13.44 KiB) Downloaded 700 times
Tepeix
Posts: 361
Joined: Sat Oct 16, 2021 3:11 pm

Re: Double condition Boolean

Post by Tepeix »

Sorry i was wrong. Inverting my input variables.

Let's say we have Y.

X = (0<Y)|(Y<1); will always be true because Y>0 or Y<1.
X = (0>Y)|(Y>1); is true if Y<0 or Y>1.

X = (0<Y)&(Y<1); is true only when 0<Y<1.

It's also possible to add more condition like
X = (a>b)&(a>c)&(a<d);
X = (a)|(b)|(c);
X = (a&b)|(c&d);
Post Reply