![]() |
Square Root
How can I implement a decently fast square root function? Is there any inline assembly I can use?
|
Re: Square Root
Do you need to take the sqr of the number every loop? If you don't then just find the sqr of the particular number and define it as a constant. If you still need a fast sqr function let me know. Private message me cause I normally forget where I've posted recently lol. :D
|
Re: Square Root
Quote:
I'm not a programmer, and I'm not sure if this applies to your question or not, but check our Question of the Day ... http://www.metalinmotion.com If what you find there is of no help, I'll mention your post to our programming sub-team. |
Re: Square Root
try this bit of code, it should give you a quick way to find square roots... but only for ints. It is accurate up to a certian point it should have enough accuracy for anything that needs to be done with our robots. If you need anything else let me know.
inline int sroot(int n) { int c = 0; int a = 1; do {n -= a; a += 2; ++c;} while (n > 0); return c; } |
| All times are GMT -5. The time now is 19:22. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi