Trigonometric Functions for the HP-38C/HP-12C - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Calculators (and very old HP Computers) ( /forum-3.html)+--- Forum: General Forum ( /forum-4.html)+--- Thread: Trigonometric Functions for the HP-38C/HP-12C ( /thread-5927.html)Pages: 1 2 |

RE: Trigonometric Functions for the HP-38C/HP-12C - tiptongrange - 07-12-2017 09:25 PM
Here's the program for this simulator adapted to run on the 12C. Since the regular 12C doesn't have the x^2 function, whenever it's called, I use GTO ###, where ### is a register at the end of the program leading the sequence (2, y^x, GTO %%%) where %%% sends it back to the line after GTO ###. This is done to preserve the correct references for the rest of the GTO functions throughout the program--if I had entered (2, y^x) in place of (y^2) directly into the code, the extra step would have thrown all of the references off. I also included the program for the solution you wrote the year before for the regular 12C. (http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=487) Since the current simulator has extra registers, I was able to append an initialization routine to load the constants, similar to what's done in the program above. This one works fairly well while the one above has problems. To load the constants just enter (g GTO 101, R/S). https://www.fastmail.com/files/45537103/?u=3d0c41af RE: Trigonometric Functions for the HP-38C/HP-12C - Dieter - 07-12-2017 09:36 PM
(07-12-2017 09:25 PM)tiptongrange Wrote: Since the regular 12C doesn't have the x^2 function, whenever it's called, I use GTO ###, where ### is a register at the end of the program leading the sequence (2, y^x, GTO %%%) where %%% sends it back to the line after GTO ###. Please, do not use 2 y^x for squaring. [ENTER] [x] is much faster and less prone to roundoff errors. It even sets LastX correctly. (07-12-2017 09:25 PM)tiptongrange Wrote: This is done to preserve the correct references for the rest of the GTO functions throughout the program--if I had entered (2, y^x) in place of (y^2) directly into the code, the extra step would have thrown all of the references off. You could adjust these references and thus avoid all those slow forward and backward jumps. Since you got the listing you can easily do it on paper, doublecheck everything and then simply enter the modified program. ;-) Dieter RE: Trigonometric Functions for the HP-38C/HP-12C - tiptongrange - 07-12-2017 10:14 PM
Thanks for the tips! Actually, using [Enter] [x] instead of [2] [y^x] solved my problems, I'm now getting correct results. I preserved the references because I think he purposely had [g GTO 090] [R/S] and [g GTO 100] [R/S] as an easy mnemonic for the cosine and tangent functions. Anyway, I'm getting almost instant results when I run the program, a blink, 'running', and then the answer in less than a second. RE: Trigonometric Functions for the HP-38C/HP-12C - Gerson W. Barbosa - 07-12-2017 11:04 PM
(07-12-2017 10:14 PM)tiptongrange Wrote: I preserved the references because I think he purposely had [g GTO 090] [R/S] and [g GTO 100] [R/S] as an easy mnemonic for the cosine and tangent functions. Anyway, I'm getting almost instant results when I run the program, a blink, 'running', and then the answer in less than a second. That was just a lucky coincidence. So 137 and 157. It wouldn't t be difficult to save a line somewhere so that the other address changes to 177 :-) Actually the program is not size-optimized as it could have been because there was plenty of space available. Been busy all afternoon. Glad to know it's been solved! |