Question: Write an ARM Assembly code subroutine to approximate the square root of an argument using the bisection method. Your code must approximate the square root

Write an ARM Assembly code subroutine to approximate the square root of an argument using the bisection method. Your code must approximate the square root of an integer between 0 and 2^(31) -1. Using integer maths is sufficient (no floating point or fractions are required); your code will return the truncated (integer portion) of the square root.

Base your software on the following pseudocode:

INPUT: Argument x, endpoint values a, b, such that a b OUTPUT: value which differs from sqrt(x) by less than 1 done 0 a0 b = square root of largest possible argument (eg,-216) C-1 do t c old - c - (a+b)/2 done 1 } else if (c*c x) { a - C else ( b-c while (Idone) && (ccold) return c

INPUT: Argument x, endpoint values a, b, such that a < b OUTPUT: value which differs from sqrt(x) by less than 1 done = 0 a = 0 b = square root of largest possible argument (e.g. ~216). C = -1 do { c_old

Step by Step Solution

3.47 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement the bisection method for approximating the square root in ARM Assembly well translate t... View full answer

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 Programming Questions!