Hello, in this thread every one can share & post different programming facts, some time we find new fact that we did not realize..
I will give you and example for first post in programming facts :
#Fact : != Operator is a combination of > operator and < operator
for example (a!=b) is a combination of (a>b || a<b)
What do you think of this thread?, if it is good idea, I hope to collect hundreds of posts that has different facts so that I and every one can get benefit.
EDIT : fixed logic mistake changed (a>b && a<b ) to (a>b || a<b)
Thanks for the noticing ne555
I got OR fact from Computer Tools For Information Age, book
Well either the book is making stuff up, or we aren't understanding what it means.
C++ certainly has a != operator.
The generated assembly doesn't, however the assembly doesn't have any operators so it wouldn't have ||, <, or > either.
The closest thing in the assembly to the != operator is the CMP instruction, and CMP is definitely closer to ==/!= than it is to some kind of weird OR operation.
so it's me I did the topic wrong, I am suppose to say that the not equal is not a primary condition, its a combination of of the basic conditions >,<, and ==
so from < and >
we can get the != operator,
#Fact : != Operator is a combination of > operator and < operator
for example (a!=b) is a combination of (a>b || a<b)
That's false.
However, there's a slight chance that your book was talking about non-equivalence relationship derived from strict weak ordering, where a is not equivalent to b if a < b or b < a.
after it mentioned equal-to condition, less-than-condition, and grater than-condition:
In addition to these three basic conditions, the computer can test for combination of conditions: less-than-or-equal-to, greater-than-or-equal-to, and less-than-or-grater-than conditions. Note that less-than-or-grater-than is the same as not-equal-to.
It seams like the book is geared towards beginners who have never seen programming before. The book uses the same as, and the computer can, which can be misleading. The OP mistook what the book said and thought that it had something to do with the low level instructions that the computer executes. All the book really meant was that the two expressions are logically equivalent.
Yes, the book starts from 0, it start from what is a computer, how can a computer increase productivity, I like to read every single line of the book don't want to miss an information even if I know most of it.
No Disch, the topic I found this sentence on is about the Arithmetic Logic Unit in the CPU.
thank you htirwin I misunderstood it as you said.
But now thanks to the kind users, I will focus more :)