Question: Write a program in the language of your choice (or use Excel) to implement the fol- lowing reciprocal division algorithm and make an observation when

Write a program in the language of your choice (or use Excel) to implement the fol- lowing reciprocal division algorithm and make an observation when D becomes 1.0. Then verify that the reciprocal division algorithm, which computes Q, is equal to N/D computed by using the divide (/) operator. The reciprocal division algorithm is as follows: #define ITERATIONS 15 Procedure () { float D, N, Q; float R; input D, N; //e.g., D = 1.99 and N = 2.4 For j = 1 to INTERATIONS do R = 2 D; D = D R; N = N R; print j, D, N, R Endfor } Note that no division operator is used in the calculation of Q; only multiplication and subtraction operations are used to compute the result of N divided by D. This algorithm was implemented in hardware as the FP divide instruction in an Intel x486 processor. Run the program twice, once with inputs D = 1.99 and N = 2.4, and again with D = 1.56 and N = 2.4. Note the fraction of D is always less than 2 (e.g., maximum fraction of D in bi- nary is 1.1111111...1 < 2 with 23 1s after the decimal point for the "float" data type and 52 is for the "double " data type

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!