Question: - Construct a control flow graph for the program using basic blocks with statement numbers. procedure sqrt(real x):real real x1, x2, x3, eps, errval; begin

- Construct a control flow graph for the program using basic blocks with statement numbers.

procedure sqrt(real x):real

real x1, x2, x3, eps, errval;

begin

1. x3 = 1;

2. errval = 0.0;

3. eps = .001

4. if (x <= 0.0)

5. output ("illegal operand");

6. return errval;

7. else

8. if (x < 1)

9. x1 = x;

10. x2 = 1;

11. else

12. x1 = eps;

13. x2 = x;

14. endif

15. while ( (x2-x1) >= 2.0*eps )

16. x3 = (x1 + x2)/2.0

17. if ( (x3 * x3 - x) * (x1 * x1 - x) < 0 )

18. x2 = x3;

19. else

20. x1 = x3;

21. endif;

22. endwhile;

23. return x3;

24. endif;

25. end

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!