hp35 is magic Message #1 Posted by hugh steers on 1 Sept 2003, 5:34 p.m.
the recent mention of csim (thanks jonathan) has got me reading the hp35 assembler again...
ive been trying to experiment with cordic calculation methods (as used in the 35). although theres several papers out there, there's not a lot of code (i couldnt find any). so i decided to try to write some.
im shifting and adding in binary, so i need 53 bits (for a double) and 53 constants (one for each mantissa bit). now, i assume the 35 worked in decimal right through, so it would need 10 ten digit constants but use each more than once (binary uses each constant for add or subtract just once).
worse, it would need to implement the hyperbolic iteration (for logs and square root), which means it needs the atanh constants as well as the atan ones. thats 20 constants.
i dont see those constants in the assember. where are they??
i read the original paper by j.s.walther of hp, "unified algorithms for elementary functions". here he describes some trickery for only storing half the constants. but i still dont see even 10 in the assember (and i know it works!). there are about 5 or so patches of "load constant X".
theres more. in my version ive separated the logic for linear, circular and hyperbolic iteration. i know you can combine them using more innerloop tests, but, it gets quite cumbersome, and you have to do the hyperbolic 3k+1 malarkey otherwise your answers are wrong.
which brings me to the final question. why didnt early models have hyperbolic functions on keyboard, since internally hyp was used for log, exp and square root. i can understand the space restriction at first, but what about hp80 and hp55. perhaps they didnt think anyone wanted them. or was it because it didnt really do the 3k+1 correction internally but somehow log and sqrt could be extracted accurately.
or perhaps its voodoo magic ;_)
my code:
http://www.voidware.com/cordic.htm
