Back to main page |
**Email me at:**
Gene!

The routines below first appeared in the N7N6P47 (July/Aug 1980) issue of the PPC Journal and were written by Andy Farber. Thanks to Andy wherever he is today!

The HP-38E and HP-38C were fine programmable business calculators. However, one shortcoming of these models (which were the same except for the HP-38C having continuous memory) was the lack of trig functions for SIN, COS and TAN. The routines below provide SIN and COS functions by evaluating the proper expansion. Taking the answer of the SIN routine and dividing it by the answer of the COS routine will, of course, provide the TAN answer. The SIN and COS answers are accurate to the 5th decimal place.

**Calculating all three functions:** Key in the two routines below
with the following line inserted after the end of the SIN routine and
before keying in the COS routine: STO 1 RCL 0. Then key in the COS routine and
add the following steps at the end of it: RCL 1, X <> Y, /, LASTX, RCL
1. That's it. The X, Y, and Z registers of the stack will now contain
the SIN, COS and TAN of the entered angle. Of course, you can change the
last few steps to suit yourself if you don't need all three functions.

**Routine for SIN: **Input angle in radians, where -PI/2 < angle <
PI/2. To convert a angle in degrees to radians, multiply the angle by PI
and divide by 180.

Line Instruction 01 ENTER 02 STO 0 03 3 04 Y^X 05 6 06 / 07 - 08 RCL 0 09 5 10 Y^X 11 5 12 N! 13 / 14 + 15 RCL 0 16 7 17 Y^X 18 7 19 N! 20 / 21 - 22 RCL 0 23 9 24 Y^X 25 9 26 N! 27 / 28 +

Line Instruction 01 STO 0 02 ENTER 03 * 04 2 05 / 06 CHS 07 1 08 + 09 RCL 0 10 4 11 Y^X 12 2 13 4 14 / 15 + 16 RCL 0 17 6 18 Y^X 19 6 20 N! 21 / 22 - 23 RCL 0 24 8 25 Y^X 26 8 27 N! 28 / 29 +

That's it. Enjoy!