This problem considers ways to computen, whereis a positive integer. This problem arose from trying to explain MATLAB’s rather large flop time in Table 1.3 for integer powers.
(a) Compare the total number of flops between computingn=∗∗ ∗, and computing
where=2. As examples of the last formula,6=∗∗, while5=∗∗.
(b) Suppose n = 28. Show that 28 = 24+ 23+ 22, and
What is the minimum number of flops required using this formula? Also explain why 24+ 23+ 22is the floating-point representation of 28. Note that this procedure is a version of the square-and-multiply algorithm.
(c) Suppose= 100, so its floating-point representation is (1 ++)×26. Explain how to use the idea in part (b) to calculate100. How does the flop count compare with the two methods in part (a)?
(d) Another approach, assumingis positive, is to writen=n ln x. Based on the values in Table 1.3, what is the approximate flop time for this? How does it compare with the flop times found in parts (b) and (c)?
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here