Is there a clever/efficient algorithm for determining the hypotenuse of an angle (i.e. sqrt(a² + b²)), using fixed point math on an embedded processor without hardware multiply?
Is there a clever/efficient algorithm for determining the hypotenuse of an angle (i.e. sqrt(a²
Share
Unless you’re doing this at >1kHz, multiply even on a MCU without hardware
MULisn’t terrible. What’s much worse is thesqrt. I would try to modify my application so it doesn’t need to calculate it at all.Standard libraries would probably be best if you actually need it, but you could look at using Newton’s method as a possible alternative. It would require several multiply/divide cycles to perform, however.
AVR resources
sqrtfunction on AVR Freaks forum