开发者

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, fo开发者_Python百科r the calculation of “a×a – b×b ” ?

Answer: 14.5


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜