Hacker News new | ask | show | jobs
by raymondh 3370 days ago
For those who are interested, CORDIC (for COordinate Rotation DIgital Computer) is another technique from that era. It "is a simple and efficient algorithm to calculate hyperbolic and trigonometric functions, typically converging with one digit (or bit) per iteration." See https://en.wikibooks.org/wiki/Digital_Circuits/CORDIC

For instructional purposes, here is a simple Python implementation that uses only adds and shifts in the inner loop, followed by a single scaled-multiply to finish it up: https://code.activestate.com/recipes/576792-polar-to-rectang...

2 comments

IIRC, CORDIC has some issues as you scale the number of bits you want--you can't just run CORDIC 64 times for 64-bits of accuracy, for example.

I think the point of diminishing returns is 14-16 bits, but it's been a long time and I'd be happy to be proven wrong.

I used CORDIC on a FPGA a few years ago to compute atan2.