Continued from
elsewhere:
GARTHWILSON wrote:
BigEd wrote:
GARTHWILSON wrote:
... I see the 6309 has a divide instruction, and that it takes a minimum of 25 clocks, so it takes more clocks to do just a divide than the '816 with tables takes to look up a trig or log function as I showed.
(It's worth noting that there are many ways to calculate log and trig, Taylor series being only one and not especially efficient. CORDIC, I think, doesn't use division. So, best not to assume that division is the limiting factor: it's slower than multiplication in every case I've seen, and so the people who design the algorithms for other calculations don't overuse it.)
I really would like to understand CORDIC, but in all my searching, none of the explanations I've found for CORDIC have been clear. I asked a friend who's a math teacher with a bachelor's degree in math, but he couldn't help me either. What I do find is that it still takes a step, with a small table lookup, for each bit or digit as you advance toward an answer; IOW, it won't be nearly as fast as a table lookup. One source said that the 8087 through 80486 used CORDIC, but that the Pentium went back to polynomial evaluation, infamous bug in the first iteration notwithstanding.
For a sufficiently large table, a table will always win, I think. Your own tables might be at the limit of convenience, and they are of course excellent if they fit what's needed, but they use a lot of memory and deliver a limited precision. Any application which needs more precision will need a different approach.
It seems that CORDIC can be thought of as a binary search. So, the tables needed to support CORDIC are very small - about the size of the number of bits you want in the result, not the size of the number of values you expect to compute. The number of operations needed is about the size of the number of bits, and the operations are just shifts and adds, which on our favourite platform are much cheaper than the multiplications needed by polynomial methods.
There's an HP Journal issue which explains the pseudo-division used in the early HP calculators. It's not CORDIC. Oh, but from 1968, we see that the HP-9100 did use CORDIC, if I understand correctly:
http://www.hpl.hp.com/hpjournal/pdfs/Is ... df#page=15Then in 1972 the HP-35 uses pseudo-division:
http://www.hpl.hp.com/hpjournal/pdfs/Is ... df#page=10I recommend also Ken Shirriff's writeup of the algorithms used in Sinclair's Scientific - it wasn't accurate, but for other reasons:
http://righto.com/sinclairI'm not sure why the Basics I'm aware of use polynomials rather than CORDIC or similar. Is there a good reason?
(Once you have fast multiplication, CORDIC doesn't look so good, which I think is why it isn't used in modern (huge) microprocessors.)