Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started