Questions tagged [boolean-logic]

5 questions
5
votes
7 answers

Can I use boolean algebra to reduce the number of lines in my code?

I am recently studying computer science and I was introduced into boolean algebra. It seems that boolean algebra is used to simplify logic gates in hardware in order to make the circuit design minimal and thus cheaper. Is there any similar way that…
themhz
  • 169
  • 1
  • 5
3
votes
2 answers

Understanding LSB and MSB

In reference to one interface control document, I found difficulty in understanding this concept. There is one parameter having LSB of 0.0625 and MSB of 2048 that should be transmitted from one piece of equipment to another. It's range is 0 to…
2
votes
1 answer

Need to match database tags using a boolean expression

I have a table, let's call it Widgets, a Tags table with about 30 tags, a WidgetsTags table that joins each widget with any number of tags, and a table called LandingPages, the landing pages are for SEO purposes, they offer pre-filtered versions of…
Neil N
  • 602
  • 3
  • 11
1
vote
1 answer

Eliminate areas of binary space and increment through result efficiently

The goal is to take a binary space, say 64 bits, and make certain parts of it "valid" and certain parts "invalid", then increment, starting at 0, through that space, avoiding the invalid areas. Space is made "invalid" by applying an arbitrary number…
Not Really
  • 19
  • 1
0
votes
5 answers

Anti-idiom? Chained equality operators

I got a headscratcher: someone submitted code to test whether all of some checkboxes were unchecked, and it indicated True when an even number were checked. The code looked something like: if (box1.checked == box2.checked == box3.checked ==…
user251748