Machine-translated by Google. Questions are authored in English.
Top

Discussion

Strength reduction replaces an operation by

  • A.a call to a library routine performing the same work
  • B.a sequence of several simpler operations of equal cost
  • C.nothing at all
  • D.a cheaper one computing the same result

Answer: D

Correct answer: a cheaper one computing the same result

The classic case is replacing a multiplication in a loop by a repeated addition, since an induction variable growing by a fixed amount can be updated incrementally. Replacing a division by a shift where the divisor is a power of two is another. The result must be identical, which is why the transformation is delicate on signed and floating point types.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.