Question: c++ program, please comment it out as much as you can. Thank you 2. A common application in computer graphics, as well as in many
c++ program, please comment it out as much as you can. Thank you

2. A common application in computer graphics, as well as in many different subfields in science and engineering, is to compute the distance between two points which involves Pythagorean theorem and hence a square root calculation. However, as accuracy of the square roo in- creases the time to compute it also increases. Often, a very coarse granularity approximation of the square root is good enough. Use Babylonian method (special case of Newton's method - Newton's mcthod is a method in calculus for determining a zero of a function) and Halley approximation to find crude estimates of square root of numbers. You may need to do some research about these algorithms (a) Babylonian Method: i. Start with an initial estimate. A rough estimate is to use the number of digits of the number to the left of the decimal point and raise 3 to the power of that number of digits. For cxample, if the uscr cnters 45346.984, thc number of digits to the left of the decimal point is 5 and the initial estimate is ro 35 - 243 ii. Iterate through the following series until a desired level of accuracy is achieved: number where nimber is the user-entered value for the square-root calculation, and n is the current iteration number of the approximation process (b) Halley Method: (a) Start with an initial estimate. A rough estimate is to use the number of digits of the number to the left of the decimal point and raise 3 to the power of that number of digits. For example, if the user enters 45346.984, the number of digits to the left of the decimal point is 5 and the initial estimate is ro - 35 243, (b) Iterate through the following series until a desired level of accuracy is achieved: Tunber 3 number
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
