Division

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

Multiplying

This is one of the four elementary, mathematical operations of arithmetic; with the others being addition, subtraction and division.

Note dshin faster

Quality Example
Slower

"Sure that s probably compiled or jit d away but you should avoid division in performance critical code it s far slower than multiplying"

from question "Any ideas on how to optimize this code? I cant seem to come up with anything that works"

Faster

"Note that i ve incorporated dshin s comment that multiplying is faster than division however the performance improvement is about 90 removing the binary search 10 multiplication vs"

from question "How to speed up a C++ sparse matrix manipulation?"

Decimal number single

Quality Example
Slower

"According to agner s instruction tables a single fp division is slower than a single reciprocal op and a single multiplying op"

from question "Why is fp division op slower than reciprocal op plus multiply op"

"I presume that you know that using a division is a lot slower than multiplying by decimal number 5 is always slower than 0.2"

from question "Create sine lookup table in C++"

Others

Quality Example
Much more concise

"But determining the digit and the carry by division is much more concise and for the larger factors also much more efficient when multiplying a digit by 100 the result is on average 450 requiring 45 subtractions but two divisions are sufficient for all factors"

from question "Algorithm slowness for Project Euler #20"

Better

"But in normal case it takes n 2 comparison so you half the height of tree but you multiplying each merge with two so total running time is not better than division to 2 part"

from question "Time complexity using N way Merge"

"While working with integer division it s better to multiplying first and divide later to minimize the rounding error"

from question "How to return result of a SELECT inside a function in PostgreSQL?"

Much more accurate

"Perhaps it s the case that division is much more accurate than reciprocal plus multiplying"

from question "Why is fp division op slower than reciprocal op plus multiply op"

Faster

"These can be compared to multiplying by 2 x left-shift or divinding by 2 x right-shift but it should be noted that a binary shift is much faster than a division operation"

from question "Bitwise operator x >> 1 and x >> 0"

More

"I read about python following pemdas that is precedence of multiplying is more than division"

from question "Operator precedence in Python -PEMDAS"

"Division of quaternion a by quaternion b is nothing more than multiplying a by the multiplicative inverse of b"

from question "Quaternions' adding, subtracting and division operations on 3d models"

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