Fast and Accurate Trigonometric Functions on the HP-12C
#1

Hello,

I've just written another program for trigs on the HP-12C, that's the third and the last one. It it kind of a "concept" program, which might be better used on the 12CP, for instance.

It gives results like these

degrees sin cos tan
60.0000 0.866025404 0.500000001 1.732050805

in 3.5s, and

arccos(0.5)=60.00000022 in less than 4.5 s.

Regards,

Gerson.

http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=487


Edited: 22 Apr 2005, 3:58 p.m.

#2

Gerson;

I had a look at the program and felt it somehow complex in terms of handling data. You used both [FV] and [n] registers, even the [g][12÷] function. That was interesting!

I didn't load it yet, but I surely will test it.

BTW, folks, I saw a NIB HP12Cp with a serial # printed in a small, thin silver label instead of having it 'carved' in the plastic case. I took a picture of it:

Anyone knows if HP is now doing this to all calculators?

Cheers.

Luiz (Brazil)

#3

Yes, I believe they are, starting with the 49g+ a few months ago.

#4

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.09E-8 to 1.23E-8, 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.38E-8, 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.

#5

Luiz,

My first 49g+ had the engraved serial number. However, both replacements have had the sticker. In fact, it seems a bit sloppy. There were little slivers of excess sticker around the case, indicating that whoever was applying them had just cleaned their x-acto blade ;)

Eric

#6

Hi, EL;

as you can see, the 'stick' glued to the one in the picture I added is not ligned up with the case. Sign of times? ;-)

Cheers.

Luiz (Brazil)

Edited: 23 Apr 2005, 5:22 p.m.

#7

Quote:
as you can see, the 'stick' glued to the one in the picture I added is not ligned up with the case. Sign of times? ;-)
Most of the classics serial numbers were not ligned up either...

Arnaud

#8

Hi, Arnaud;

you are right, I cannot help noticing the same fact. What bothers me is the fact that I (and maybe many others) expect development and new technology to enhance quality of final products, costs and profit being cut or enhanced as well. We all have seen that this is not true in some aspects, new pseudo-HP calculators are some examples. I mentioned the sticker not ligned up based on some expectations... of mine.

Best regards.

Luiz (Brazil)



Possibly Related Threads…
Thread Author Replies Views Last Post
  A fast Bernoulli Number method for the HP Prime Namir 16 5,355 11-22-2013, 04:46 PM
Last Post: Namir
  HP Prime - CAS functions in Spreadsheet App CR Haeger 6 2,395 11-11-2013, 12:37 AM
Last Post: Michael de Estrada
  [41CL] New Extra Functions version Monte Dalrymple 0 1,082 11-08-2013, 04:32 PM
Last Post: Monte Dalrymple
  HP Prime: in need of help with defining functions Alberto Candel 14 4,183 10-27-2013, 10:48 AM
Last Post: Alberto Candel
  HP Prime spreadsheet functions SanS 0 1,875 10-04-2013, 04:23 AM
Last Post: SanS
  Stats functions on the HP34S Nicholas van Stigt 5 1,949 09-24-2013, 02:45 AM
Last Post: Nick_S
  Trig Functions Howard Owen 11 3,408 09-16-2013, 02:53 PM
Last Post: Fred Lusk
  50g piecewise functions Kurt Fankhauser 6 2,292 09-15-2013, 08:01 PM
Last Post: Kurt Fankhauser
  Computer-scientist functions on HP Prime? Michael O. Tjebben 12 3,469 08-22-2013, 06:59 PM
Last Post: plivesey
  Missing functions on the HP Prime!!!??? :-( Namir 6 2,218 08-22-2013, 08:40 AM
Last Post: Gilles Carpentier

Forum Jump: