Division

In mathematics, division (÷) is an arithmetic elementary operation.

Subtraction

Subtraction is a mathematical operation that represents the removal of an object from a collection.

Operator higher preference

Quality Example
Greater precedence

"In this since division has greater precedence than subtraction therefore x 10 will execute first and here we are dividing two int irrespective of the fact that the variable where final answer is stored is a double so answer will be an int i.e 5 10 0 and then subtraction of an int and double will be done here int will be promoted to a double"

from question "Java primitive types promotion confusion"

"I don t think they have a natural precedence unlike say multiplication and division being of greater precedence than subtraction and addition because they can be built from subtraction and addition"

from question "Bitwise operators order of precedence"

Operator higher precedence

"Doesn t get evaluated the way you are expecting the division operator has higher precedence than the subtraction operator"

from question "How many hours have passed"

"That s because the division operator has a higher precedence than the subtraction operator -"

from question "Bad value in calculation output"

"Because the division operator has higher precedence than subtraction"

from question "Convert HSB/HSV color to HSL"

Operator higher

"This is because division operator has higher preference than the subtraction operator - in the first example you use are not using brackets therefore division takes place first you can change your code to"

from question "Random output from forumla in C"

Higher

"Division has higher precedence than subtraction so in the first two examples only the second number is being divided"

from question "Ruby math issue with division"

Higher precedence

"Division has higher precedence than subtraction"

from question "Complex calculation in JavaScript"

"In this case division has higher precedence than subtraction parenthesis around the division or not"

from question "Why does C assume integer type within a calculation for a double?"

"Remember multiplication division and remainder operators are all higher precedence than subtraction"

from question "Other way to solve assigning"

"Without parentheses math.exp c b is executed first as division has higher precedence than subtraction -"

from question "Actionscript calculates erroneous division without brackets"

Reduction optimization stronger

Quality Example
Slower

"I am a bit suspicious of the performance because modulo tends to use division which is slower than your subtraction operations"

from question "Calculate difference between multiples of two different numbers"

"This platform is probably not representative of your microcontroller but the test shows that on this platform the subtraction is considerably slower than the division"

from question "Converting to ASCII in C"

Weaker

"This is called a strength reduction operation because subtraction is a weaker and cheaper operation than division"

from question "How do initialize an SIMD vector with a range from 0 to N?"

Stronger

"This is called a strength reduction optimization because division is stronger slower more expensive than subtraction"

from question "Assembly language making a for loop that runs n/10 times"

Operation tighter

"The division operation binds tighter than i.e is evaluated ahead of the subtraction so you are taking a square root of a negative number"

from question "Why am I getting imaginary numbers instead of a simple answer"

Others

Quality Example
Trickier

"Subtraction is similar using subtraction of the base type and borrow instead of carry multiplication can be done with repeated additions very slow or cross-products faster and division is trickier but can be done by shifting and subtraction of the numbers involved the long division you would have learned as a kid"

from question "Arbitrary-precision arithmetic Explanation"

Easier

"It may not be the most elegant method but when you just need to convert something ad-hoc thinking of it as comparison and subtraction may be easier than division"

from question "Is it possible to use logarithms to convert numbers to binary?"

Back to Home
Data comes from Stack Exchange with CC-BY-SA-3.0