user565772
user565772

Reputation: 3

Explain how cpu time was computed

Question: When a CPU can perform a multiplication in 12 nanoseconds (ns), an addition in 1 ns, and a subtraction in 1.5 ns, which of the following is the minimum CPU time, in nanoseconds, for the calculation of “a×a – b×b ” ?

Answer: 14.5

Upvotes: 0

Views: 193

Answers (1)

Shaded
Shaded

Reputation: 17836

I believe it optimizes the equation to (a-b)*(a+b) so it's subtraction + addition + multiplication = 12 + 1 + 1.5 = 14.5.

Though my math isn't the best around so if I'm wrong just comment and don't downvote so I can delete :D

Upvotes: 2

Related Questions