Question: 4a. Critical Thinking Exercise: In the previous exercise, it probably took your computer 0 seconds to use each of the functions for each of the

 4a. Critical Thinking Exercise: In the previous exercise, it probably took

4a. Critical Thinking Exercise: In the previous exercise, it probably took your computer 0 seconds to use each of the functions for each of the input values. Both operations are so fast, that we cannot determine which one is faster. In order to do so, you will modify the sqrt2.cpp program so that each function is called a significant number of times for the same input value. To do this, change the value of ITERATIONS to 100000000. Save your program as sqrt3.cpp. Use the following space to write the line(s) you modified in your program. Compile, link, and execute the program. Fill the following table with the results from your program: Input Values (x) Time to calculate pow (x, 0.5), 100,000,000 times. Time to calculate sqrt(x), 100,000,000 times. 13 121 1029 4b. Compare the results shown in the table above. Which function (pow or sqrt) is more efficient in calculating the square root of a number? 4a. Critical Thinking Exercise: In the previous exercise, it probably took your computer 0 seconds to use each of the functions for each of the input values. Both operations are so fast, that we cannot determine which one is faster. In order to do so, you will modify the sqrt2.cpp program so that each function is called a significant number of times for the same input value. To do this, change the value of ITERATIONS to 100000000. Save your program as sqrt3.cpp. Use the following space to write the line(s) you modified in your program. Compile, link, and execute the program. Fill the following table with the results from your program: Input Values (x) Time to calculate pow (x, 0.5), 100,000,000 times. Time to calculate sqrt(x), 100,000,000 times. 13 121 1029 4b. Compare the results shown in the table above. Which function (pow or sqrt) is more efficient in calculating the square root of a number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!