alternative cos(x) and tan(x) [HP-33S]
#1

Each of the following programs takes up only one label and will always give at least 11 correct digits for arguments in degrees ( -999,999,999,909 <= x <= 999,999,999,999 ).

Gerson.


L0001 LBL L
L0002 x<>y
L0003 STO A
L0004 x<>y
L0005 +/-
L0006 90
L0007 +
L0008 360
L0009 RMDR
L0010 STO B
L0011 90
L0012 INT/
L0013 STO C
L0014 ENTER
L0015 ENTER
L0016 2
L0017 INT/
L0018 -
L0019 180
L0020 *
L0021 RCL- B
L0022 -1
L0023 RCL C
L0024 ENTER
L0025 x!
L0026 +
L0027 y^x
L0028 *
L0029 STO B
L0030 x^2
L0031 ENTER
L0032 ENTER
L0033 ENTER
L0034 2.0934E-26
L0035 *
L0036 4.47566E-20
L0037 -
L0038 *
L0039 5.55391606E-14
L0040 +
L0041 *
L0042 3.28183761372E-08
L0043 -
L0044 *
L0045 5.81776417331E-03
L0046 +
L0047 RCL* B
L0048 ENTER
L0049 x^2
L0050 4
L0051 *
L0052 +/-
L0053 3
L0054 +
L0055 *
L0056 RCL A
L0057 x<>y
L0058 RTN

LN=330
CK=AE03


M0001 LBL M
M0002 DEG
M0003 x<>y
M0004 STO D
M0005 x<>y
M0006 SIN
M0007 LASTx
M0008 XEQ L
M0009 /
M0010 RCL D
M0011 x<>y
M0012 RTN

LN=36
CK=3737


89.9999999 XEQ L -> 1.74532925199E-9
89.9999999 COS -> 1.74532000000E-9
actual -> 1.74532925199433E-9


89.9999999 XEQ M -> 572,957,795.132
89.9999999 TAN -> 572,960,832.397
actual -> 572,957,795.1308232

-5555 XEQ L -> -9.06307787035E-1
-5555 COS -> -9.06307787037E-1
actual -> -9.06307787036650E-1

#2

Thanks Gerson for sharing yet another version of your minimax polynomial approximations of some of the trigonometric functions.

For fussbudgets like me, this will be very useful, and I will enter them in my HP35S (the porting should be easy) when I get it.

I am actually more troubled by the persistence of the cosine bug than the inconvenient entry of hex numbers everyone seems so fussed about. The persistence of the digit loss for arguments approaching 90 degrees has accuracy implications for the sine of very small angles, the tangent function, complex number math, and of course rectangular-polar conversions.

FWIW, can someone with a 35S compute the cosine for 89.99, 89.999, 89.9999, and 89.99999, etc., degrees and let us all know?

Les

#3

Quote:
FWIW, can someone with a 35S compute the cosine for 89.99, 89.999, 89.9999, and 89.99999, etc., degrees

cos(89.99) = 1.74532924306 E-4

cos(89.999) = 1.74532925091 E-5

cos(89.9999) = 1.74532925 E-6

cos(89.99999) = 1.7453292 E-7

cos(89.999999) = 1.745329 E-8

cos(89.9999999) = 1.74532 E-9

cos(89.99999999) = 1.74532925199 E-10

cos(89.999999999) = 1.74532925199 E-11

cos(89.9999999999) = 1.74532925199 E-12

cos(89.99999999999) = 1.74532925199 E-12

cos(89.999999999999) = 1.74532925199 E-12

.

.

.

Edited: 23 July 2007, 11:14 p.m.

#4

Thanks!

Yep, the cosine bug has survived unchanged.

I am actually intrigued that when one gets to 89.99999999, full 12-digit accuracy in the result returns. Weird! I am sure someone once explained the cause of this bug.

Les

Edited: 24 July 2007, 5:35 a.m.

#5

Quote:
I will enter them in my HP35S (the porting should be easy) when I get it.

Hello Les,

I think it will run with no modification on the HP-35s. But it will require three keystrokes to access the function, by what I've read: [XEQ] [L] [ENTER], for instance, instead of the more convenient [XEQ] [COS] on the HP-33s.

Best regards,

Gerson.

#6

Hi Les (and all).

The 35s review at the hpcc.org site stated that the COS bug was still there. This was available the day the 35s was announced.

Datafile 35s review

#7

Gerson,

Your routines are very fast. Say what you like about the now obsolete 33S, but it does run keystroke programs with lightning quickness. I understand that in many cases the 35S may actually be slower!

I also like how you preserve the contents of the Y register for subsequent calculations. Unfortunately the routines don't keep the entire stack in its original state, but this is a nice touch. One problem about RPN programs is they make a mess of the stack sometimes, unlike the internal routines. RPL programs tend not to do this, unless you want them too.

Les

#8

Hello Les,


Quote:
Your routines are very fast. Say what you like about the now obsolete 33S, but it does run keystroke programs with lightning quickness. I understand that in many cases the 35S may actually be slower!

Too bad they don't run fast enough on the 35s: about 1.5 seconds. They appear to run 10 times faster on the 33s (no timing so far).
Also, [XEG] [COS] [ENTER] is very inconvenient. And having to press [>] to see the exponent is pretty cumbersome. Didn't they realize the exponent is much more important than the least significant digits? I prefer ALL mode, not that I don't care about all those digits, but because I don't like integers being displayed will all those zeros. I am very inclined to getting rid of this 35s and getting another obsolete 33s...

Regards,

Gerson.



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Download] PrimeComm: Alternative small utility to upload/download programs to the HP Prime Erwin Ried 6 2,475 11-17-2013, 10:18 AM
Last Post: Erwin Ried
  HP-35s Cos[x] and Tan[x] bugs resolved? Thomas Windisch 2 1,483 10-31-2013, 01:12 PM
Last Post: Dieter
  [wp34s] Alternative MIO (allows calculations when entering element values) David Maier 1 1,030 02-03-2013, 02:51 PM
Last Post: Marcus von Cube, Germany
  [41CL] Alternative serial connector, saving a port Kerem Kapkin (Silicon Valley, CA) 24 6,561 07-06-2012, 11:51 AM
Last Post: aurelio
  HP 15C LE COS key troy 6 1,708 09-18-2011, 12:05 PM
Last Post: From Hong Kong
  where is 35s cos bug Andrew Nikitin 3 1,218 10-06-2008, 01:41 AM
Last Post: Karl Schneider
  Very nice HP-95LX book, alternative to the manual Johnny Bjoern Rasmussen 0 720 06-26-2008, 03:33 AM
Last Post: Johnny Bjoern Rasmussen
  [OT] (Cos x)^x Chuck 11 2,742 12-01-2007, 01:48 PM
Last Post: Karl Schneider
  An Alternative 45s Concept Jeff O. 31 6,328 10-25-2007, 12:57 AM
Last Post: Hugh Evans
  HP 35s trigonometric functions alternative Lyuka 5 1,604 08-30-2007, 10:01 PM
Last Post: Gerson W. Barbosa

Forum Jump: