Post Reply 
HP-35 style trig functions
01-15-2019, 03:43 AM (This post was last modified: 01-15-2019 03:51 AM by Dan.)
Post: #9
RE: HP-35 style trig functions
(01-14-2019 02:34 AM)Druzyek Wrote:  Do any of them use a table of atan(10^(-i))? That lets you shift X and Y to divide by 10, which is easy in BCD. Everything else I've seen (other than the links I posted) uses a table of atan(2^(-i)), which means you have to halve BCD values and that is turning out to be extremely slow.

The algorithm presented on page 1 - 9 of this paper uses base 2 but it can be modified to use base 10. However doing so places a limit on the size of the angle since atan(10^0) + atan(10^-1) + atan(10^-2) +...< 52 degrees, whereas in the original base 2 algorithm atan(2^0) + atan(2^-1) + atan(2^-2) +... < 100 degrees, meaning the first quadrant is covered. But the author states on page 18 that

"The preceding approach could be reworked using powers of 1/10 instead of powers of 1/2; it is only necessary (as was done for the hyperbolic examples) to work with lists that contain many duplicate entries".

I recall other authors mentioning that base 10 can be used but I've never implemented CORDIC algorithms for sine and cosine so I don't know the details.

(01-14-2019 02:34 AM)Druzyek Wrote:  I'm keeping everything in BCD without ever converting to binary. My numbers are 16 bytes of packed BCD.

So numbers are 32 digits long? If you are not converting to binary then what algorithms are you using for multiplication and division? Are you using CORDIC algorithms for these as well?
EDIT: I've just seen that you have an article on your webpage on BCD multiplication, which I look forward to reading!

(01-14-2019 02:34 AM)Druzyek Wrote:  I'm using an MSP430 programmed in assembly, so no hardware multiply or divide. I used the same chip programmed in C for my first calculator: RPN Scientific Calculator. The chip has 16 bit registers and a BCD add instruction, so it is not bad to work with in assembly. Using the slow divide by 2 CORDIC I have the four functions plus the 6 trig and inverse functions in only 4k of firmware.

Great work Druzyek, I look forward to checking out the link!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP-35 style trig functions - Druzyek - 01-13-2019, 08:32 PM
RE: HP-35 style trig functions - pier4r - 01-13-2019, 08:37 PM
RE: HP-35 style trig functions - Druzyek - 01-14-2019, 12:56 AM
RE: HP-35 style trig functions - Dan - 01-14-2019, 01:31 AM
RE: HP-35 style trig functions - Druzyek - 01-14-2019, 02:34 AM
RE: HP-35 style trig functions - Dan - 01-15-2019 03:43 AM
RE: HP-35 style trig functions - Druzyek - 01-15-2019, 11:49 PM
RE: HP-35 style trig functions - Druzyek - 08-28-2023, 12:19 AM



User(s) browsing this thread: 1 Guest(s)