can smb explain what is the difference between bitwise and logical operators?
i dont understand at all. and the more i google the less i get it.
7 Replies
⌛
This post has been reserved for your question.
Hey @bambyzas! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
... The logical operators apply on booleans, while the bitwise operators apply on ints or longs.
but if i have this: select * from customercontacts where type &1!=1 --mobile and type &4!=4;
what does it even mean? how do i know is it logical operator of binary?
That's not Java
yes
but these operators dont depend on one language
There are languages that don't have bitwise operators, and some that, when they do, they have them in a way that doesn't look like at all like the logical operators
As far as I know SQL is one such language
Anyway, the general, not-language-bound idea with bitwise operators is that:
- they perform operations on all the bits of their operands, if said operands have more bits than a boolean.
- they don't shortcut the evaluation. Like if the expression contains checkThis & computeThat(), and checkThis is evaluated to false, they will evaluate computeThat() anyway, despite it is already known that the end result is false.
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.