Re: Congrats! (and new HP12Cp serial# label?) Message #4 Posted by GWB on 22 Apr 2005, 10:20 p.m., in response to message #2 by Vieira, Luiz C. (Brazil)
Hello Luiz,
I used [12÷] in line 03 instead of [3] [÷] to save one step. In the first instructions the input angle in degrees is converted to radians and then divided by three. Instead of dividing it by the factor 180/pi and then by 3 it is divide by 45/pi and then by 12, which is equivalent. At line 91 the output angle in radians had to be multiplied by 2 and then by 180/pi to convert it to degrees. As the conversion fact store in R0 is 45/pi, it is multiplied by 8 instead.
At line 72, the coefficient of x^9 of the arctan approximation polynomial was 0.079638. I changed it to 0.08 and recalculated the three others coefficients. Doing this caused the maximum absolute error change from 1.09E8 to 1.23E8, nothing to worry about. But again I needed two more steps, so I changed .08 to [12÷], that is, .08333333, recalculated the coefficient and came up with an error of 3.38E8, considered acceptable. Later I decided to use the financial register n to avoid a square root computation and increase speed by .2 or .3 seconds. This had the side effect to save two steps. As the approximation was acceptable, I included the test for zero at line 51 (a good idea! No, Luiz, I don't drink :), thus avoiding the Error 0 message, at least for the atan routine. Both 12x and 12÷ instructions may be handy, but they don't cause an automatic stack lift, that is why is is at line 76 rather than 77.
[n] and [FV] have been used just because I ran out of registers.
Thanks for the congratulation, but as I said, it is just a concept, something to be better implemented on the 12CP (I don't intend to buy one though).
Cheers,
Gerson.
Edited: 23 Apr 2005, 12:14 a.m.
