0

I am writing a task as my homework and I am having troubles with figuring out how to calculate a square root of a number in ARMSim. I cannot come to an answer, and I've been trying for the past few days. Does anyone know how can i get the sqaure root? (I am not asking for a code if someone would think that, I am asking for help with logically dividing or substracting to get the square root). Thanks in advance.

0dumba
  • 9
  • 2
  • Are you looking to take the square root of an integer or a floating-point number? – EOF Oct 21 '16 at 16:11
  • Maybe this helps: http://stackoverflow.com/questions/3581528/how-is-the-square-root-function-implemented#14371766 – RhinoDevel Oct 21 '16 at 16:12
  • You might get some ideas [from here](https://en.wikipedia.org/wiki/Methods_of_computing_square_roots). Heron's method is easy to implement and converges quickly. – Weather Vane Oct 21 '16 at 16:13
  • Possible duplicate of [Writing your own square root function](http://stackoverflow.com/questions/1623375/writing-your-own-square-root-function) – Notlikethat Oct 21 '16 at 16:14
  • For unsigned integers, I have used a method that performs a trial multiplication for each bit of a supposed square root, starting with the m.s. bit and working down. If the product is < the argument number, leave that bit set, else reset it. Move to the next l.s. bit. – Weather Vane Oct 21 '16 at 16:18
  • EOF - the task doesn't specify but i think just the integers. RhinoDevel - Thank you very much Weather Vane - Thank you for the reply, I will look into it and try to impelement it into my program Notlikethat - I hadn't found that article as I was looking only in the ARMSim section, but thank you Thank you all for the replies, it means so much. – 0dumba Oct 21 '16 at 17:09
  • @HrvojeDumančić if you wish to address a comment to someone, please use the `@` like I have done here, which will flag them. Max one username per comment, so you can make a separate comment to each. – Weather Vane Oct 21 '16 at 17:20
  • @WeatherVane thank you for the help. as it can be seen, this is my first asked question. Thank you for the help. – 0dumba Oct 21 '16 at 18:06
  • You are very welcome. – Weather Vane Oct 21 '16 at 18:07

0 Answers0