Addition
Addition is a mathematical operation that represents combining collections of objects together into a larger collection
Subtraction
Subtraction is a mathematical operation that represents the removal of an object from a collection.
Slower chip architecture
Example |
---|
"Here it is conceivable that subtraction is slower than addition" from question Does Adding A Value Differ In Computational Requirement From Subtracting A Value? "This is a hold over from older compilers and interpreters on old chip architecture that would do addition slightly slower than subtraction" from question How can I enhance this for loop |
"But i d think bignum subtraction is a little slower than bignum addition" from question Fermat vs Mersenne as modulus |
"The mul are slower less efficient than addition subtraction but the mul are much faster than looping and doing repeated additions" from question MASM code to calculate multiples and powers through addition |
Precedence higher multiplication
Example |
---|
"In fact has precedence even lower than addition and subtraction so x y+z comes out wrong--an expression means x y+z instead of the x y +z that you d want" from question How to use a Caret "^" in C++ for Exponentiation |
"The only way it would be broken up differently would be if addition had a higher precedence than subtraction like multiplication does" from question How does Javascript handle BODMAS? |
Better operation cryptographic
Example |
---|
"A111 addition is equal or better than subtraction" from question Minimum number of steps to reduce number to 1 |
"The third is that there is an operation that is much better than addition subtraction for cryptographic purposes xor or - the beauty of which is that it is its own inverse" from question C: How to add char to chars, and when the max char is reached have it loop back to 'a'? |
Others
Example |
---|
It s possible though that software could mess things up by making subtraction slower than addition - but that s unlikely from question Does Adding A Value Differ In Computational Requirement From Subtracting A Value? |
The subtraction case is going to require a little more work than addition in this code from question Blue Pelican Add 'Em Up Project |
Therefore subtraction is not associative;on the other hand a+b doesn t cause the same problem since addition is an associative operator from question What do the Stream reduce() requirements exactly entail? |
I have this homework that requires me to ask for two integers from the user let them choose between addition or subtraction and then display the result from question How to check if input is int? |
I was thinking that there could be an issue if the result from the addition is bigger than what 15 bits can represent 32767 or if i get a negative number in the subtraction from question VHDL: issues with adding and subtracting |
Subtraction is also described there;edit since its not clear if the op meant unsigned addition thats also not too hard to detect from question Check carry from long operation in java |
This took 6 steps but leads to a number that could be arrived at in 5 steps subtract 1 divide 3 times add 1 so clearly we should not perform the addition;subtraction is always better from question Minimum number of steps to reduce number to 1 |