Even Faster and More Accurate Trigonometric Functions on the HP-12C Platinum (Long)



#6

I received yesterday my HP 12c Platinum 25th Anniversary Edition from Samson Cables. I tried my own trigs program on it and was not
pleased with the speed:
2.8 s for SIN and COS, 3.4 s for inverse trigs are not so bad but 5.4 s for TAN is too much!
Now the constants needed by the program are not built-in anymore. Instead, they have to be loaded by means of an optional or
manually stored into registers 7 through .5 when needed. On the other hand, the program is now about 33% faster, still not so fast
but more acceptable for occasional calculations. The main 191-step long program can fit in earlier 12C Platinums but it has not been
tested on them yet.

Best regards,

Gerson.

-----------------------------------

TRIGONOMETRIC FUNCTIONS ON THE 12C PLATINUM

001- 2 063- Rv 125- g LSTx 187- x<>y 246- 9
002- STO 6 064- CHS 126- g x<=y 188- - 247- 1
003- Rv 065- 9 127- g GTO 130 189- RCL 5 248- 6
004- x<>y 066- 0 128- 1/x 190- * 249- 0
005- STO .0 067- + 129- 9 191- RCL 7 250- 6
006- x<>y 068- g GTO 004 130- 0 192- g x=0 251- EEX
007- 9 069- STO .0 131- STO 6 193- g GTO 200 252- 1
008- 0 070- x<>y 132- x<>y 194- x<>y 253- 4
009- g x<=y 071- STO 9 133- 2 195- CHS 254- CHS
010- g GTO 014 072- 1 134- ENTER 196- 9 255- STO .4
011- CHS 073- STO 6 135- 3 197- 0 256- 3
012- g x<=y 074- RCL .0 136- g SQRT 198- + 257- .
013- g GTO 019 075- g GTO 007 137- STO 9 199- x<>y 258- 2
014- 2 076- CLx 138- - 200- x<>y 259- 8
015- * 077- STO 6 139- x<>y 201- RCL .0 260- 1
016- x<>y 078- x<>y 140- g x<=y 202- x<>y 261- 8
017- - 079- RCL .0 141- g GTO 153 203- g GTO 000 262- 3
018- g GTO 020 080- g GTO 064 142- ENTER 263- 7
019- Rv 081- x<>y 143- ENTER 264- 6
020- STO 8 082- RCL .0 144- RCL 9 265- 1
021- g x^2 083- x<>y 145- * 204- 1 266- 4
022- ENTER 084- / 146- 1 205- . 267- EEX
023- ENTER 085- RCL 9 147- - 206- 7 268- 8
024- ENTER 086- x<>y 148- x<>y 207- 4 269- CHS
025- RCL .2 087- g GTO 000 149- RCL 9 208- 5 270- STO .5
026- * 088- 0 150- + 209- 3 271- .
027- RCL .3 089- STO 7 151- / 210- 2 272- 0
028- - 090- Rv 152- 3 211- 9 273- 7
029- * 091- x<>y 153- 0 212- 2 274- 8
030- RCL .4 092- STO .0 154- STO 8 213- 5 275- 4
031- + 093- x<>y 155- x<>y 214- 2 276- CHS
032- * 094- ENTER 156- STO 9 215- EEX 277- STO .6
033- RCL .5 095- g x^2 157- g x^2 216- 2 278- .
034- - 096- 1 158- ENTER 217- CHS 279- 1
035- * 097- - 159- ENTER 218- STO .1 280- 1
036- RCL .1 098- g x=0 160- ENTER 219- 2 281- 0
037- 3 099- g GTO 104 161- RCL .6 220- . 282- 3
038- / 100- CHS 162- * 221- 0 283- 5
039- + 101- g SQRT 163- RCL .7 222- 9 284- 1
040- RCL 8 102- / 164- + 223- 4 285- STO .7
041- * 103- g GTO 117 165- * 224- EEX 286- .
042- ENTER 104- x<>y 166- RCL .8 225- 2 287- 1
043- g x^2 105- 9 167- - 226- 6 288- 4
044- 4 106- 0 168- * 227- CHS 289- 2
045- * 107- * 169- RCL .9 228- STO .2 290- 8
046- CHS 108- g GTO 191 170- + 229- 4 291- 3
047- 3 109- 1 171- * 230- . 292- 7
048- + 110- g GTO 089 172- 3 231- 4 293- 9
049- * 111- 0 173- 1/x 232- 7 294- 6
050- RCL 6 112- STO 7 174- - 233- 5 295- STO .8
051- 2 113- Rv 175- * 234- 6 296- .
052- g x<=y 114- x<>y 176- 1 235- 5 297- 1
053- g GTO 058 115- STO .0 177- + 236- EEX 298- 9
054- Rv 116- x<>y 178- RCL 9 237- 2 299- 9
055- g x=0 117- ENTER 179- * 238- 0 300- 9
056- g GTO 081 118- g x^2 180- RCL .1 239- CHS 301- 9
057- g GTO 076 119- g SQRT 181- / 240- STO .3 302- 9
058- Rv 120- g x=0 182- RCL 8 241- 5 303- 8
059- x<>y 121- g GTO 191 183- + 242- . 304- 3
060- g GTO 201 122- / 184- RCL 6 243- 5 305- 3
061- 2 123- STO 5 185- g x=0 244- 5 306- STO .9
062- STO 6 124- 1 186- x<>y 245- 3 307- g GTO 000

SIN: R/S (-180 <= x <= 180)
COS: g GTO 061 R/S (-180 <= x <= 180)
TAN: g GTO 069 R/S (-180 <= x <= 180)
ASIN: g GTO 088 R/S (-1 <= x <= 1)
ACOS: g GTO 109 R/S (-1 <= x <= 1)
ATAN: g GTO 111 R/S (-9.99...E49 <= x <= 9.99...E49)

All angles are in DEGREES. Use RCL .1 (pi/180) to convert to and from radians.

Steps 204 through 307 are optional and allow for automatic loading of the constants used by the program (g GTO 204 R/S).
This should be done before running the program for the first time or when registers .1 through .9 have been changed or
cleared.

The only angular mode is DEGREES. Use RCL 7 (pi/180) to convert to
and from radians.

In case you decide not to enter the optional steps, either because you have an earlier 12C Platinum which does not handle
large programs or because you need programming memory for something else, you should store the constants manually in the following registers:

R.1: 1.745329252E-02 (pi/180)

R.2: 2.094E-26
R.3: 4.47565E-20
R.4: 5.55391606E-14
R.5: 3.281837614E-08 (sine polynomial coefficients)


R.6: -0.0784
R.7: 0.110351
R.8: 0.14283796
R.9: 0.199999833 (arctangent polynomial coefficients)
(another coefficient, 1/3, is included in the program, at lines 172 and 173)

The registers 5 through .0 are used by the program as temporary variables. Registers 0 through 4 and the financial registers are always available to the user. The stack register X is saved before running the program, which allows for limited chain calculations
(1 level only).

Timing

SIN, COS: ~ 1.7 s
TAN: ~ 3.4 s
ASIN, ACOS, ATAN: ~ 2,5 s

Sample calculations

First set the display to FIX 9 mode:

f 9

1) asin(acos(atan(tan(cos(sin(9)))))):

Keystrokes Display

9 9.
R/S 0.156434465
g GTO 061 R/S 0.999996273
g GTO 069 R/S 0.017455000
g GTO 111 R/S 0.999996273
g GTO 109 R/S 0.156434462
g GTO 088 R/S 8.999999795

2) sin230 + cos230:

Keystrokes Display

30 R/S 0.500000000
g x2 0.250000000
30 g GTO 061 R/S 0.866025404
g x2 0.750000000
+ 1.000000000

3) tan 0.15 rad:

Keystrokes Display

.15 RCL .1 0.017453293 (pi/180)
/ 8.594366927
g GTO 069 R/S 0.151135218

Accuracy comparison with other HP calculators

Sin(x):

x (deg) HP-15C HP-12CP HP-35
---------------------------------------------------------------
0.000000 0.0000000000 0.0000000000 0.0000000000
0.000010 1.745329252E-07 1.745329252E-07 1.745000000E-07
0.000110 1.919862177E-06 1.919862177E-06 1.919800000E-06
0.022000 3.839724260E-04 3.839724260E-04 3.839723910E-04
3.330000 5.808674960E-02 5.808674960E-02 5.808674960E-02
14.44000 0.2493660251 0.2493660251 0.2493660250
25.55000 0.4312985870 0.4312985870 0.4312985871
36.66000 0.5970652564 0.5970652564 0.5970652561
47.77000 0.7404527827 0.7404527827 0.7404527828
58.88000 0.8560867283 0.8560867283 0.8560867285
69.99000 0.9396329127 0.9396329127 0.9396329127
81.11000 0.9879868528 0.9879868528 0.9879868527
88.88000 0.9998089500 0.9998089500 0.9998089499
89.99900 0.9999999998 0.9999999999 0.9999999998
89.99990 1.0000000000 1.0000000000 1.0000000000
90.00000 1.0000000000 1.0000000000 1.0000000000

Tan(x):

x (deg) HP-15C HP-12CP HP-35
---------------------------------------------------------------
0.000000 0.0000000000 0.0000000000 0.0000000000
0.000010 1.745329252E-07 1.745329252E-07 1.745000000E-07
0.000110 1.919862177E-06 1.919862177E-06 1.919800000E-06
0.022000 3.839724543E-04 3.839724543E-04 3.839724542E-04
3.330000 5.818499267E-02 5.818499267E-02 5.818499260E-02
14.44000 0.2575006491 0.2575006491 0.2575006490
25.55000 0.4780471798 0.4780471798 0.4780471798
36.66000 0.7442915883 0.7442915883 0.7442915880
47.77000 1.101686578 1.101686578 1.101686578
58.88000 1.656411391 1.656411391 1.656411391
69.99000 2.745986117 2.745986117 2.745986119
81.11000 6.393166451 6.393166451 6.393166426
88.88000 51.15042993 51.15042993 51.15042860
89.99900 57295.77951 57295.77951 57296.55162
89.99990 572957.7951 572957.7951 573019.3057
90.00000 9.999999999E+99 Error 0 9.999999999E+99

ArcTan(x):

x HP-15C HP-12CP HP-35
---------------------------------------------------------------
0.00000 0.0000000000 0.0000000000 0.0000000000
0.00011 6.302535721E-03 6.302535721E-03 6.302535688E-03
0.15500 8.810732986 8.810732986 8.810732984
0.26795 15.00004317 15.00004317 15.00004317
0.41421 22.49982578 22.49982578 22.49982579
0.57735 29.99998843 29.99998843 29.99998843
0.77700 37.84720677 37.84720677 37.84720676
0.88800 41.60507646 41.60507646 41.60507646
1.00000 45.00000000 45.00000000 45.00000000
1.22200 50.70548702 50.70548702 50.70548702
1.48880 56.11145723 56.11145723 56.11145722
2.11100 64.65265735 64.65265735 64.65265735
4.88800 78.43782359 78.43782359 78.43782360
7.55500 82.46000683 82.46000683 82.46000679
99.9990 89.42705557 89.42705557 89.42705555
3333333 89.99998281 89.99998281 89.99998281

-------------------------------------

Edited to add missing information... and to fix two typos in the listing, sorry! Also the program has been slightly changed: now ACOS accepts negative arguments.

Jul/31: Edited again to include more accurate version. SIN, COS and TAN are granted to be accurate in the range from -180 to 180 degrees.


Edited: 31 July 2006, 11:51 a.m. after one or more responses were posted


#7

...


#8

..

#9

Gerson --

Congratulations on a fine effort. After feedback is received, I think you should refine and format your post as necessary for the MoHPC Articles.

Best regards,

-- KS


#10

Thanks, Karl!

Quote:
After feedback is received, I think you should refine and format your post as necessary for the MoHPC Articles.

I surely should. It seems, however, this kind of program is of little to absolute no interest to the average 12cp user, given the low number of feedbacks received so far. Also, nowadays a really useful 12cp program should include an ALG version, which I am neither inclined to write nor don't know how to.

My motivation in writing such a program began about one year ago, when I purchased a brand-new 12C just because it had the same form factor of the 15C I liked and had no more. Unaware of some fine trig solutions around, I immediately wrote a simple program based on Taylor's series. Obviously I was unable to find room for the inverse functions, but what bothered me most was its sluggish speed. I tried another awkward low-accuracy solution (you still can find it in the Articles Forum - have to remember to wipe it off!). Later I found an excellent article from a researcher at Sony Entertainment of America on fast ways to implementing trigonometric functions - it appears they don't play all the time. Using some ideas therein I came up with a fast and reasonably accurate program for the 12C. Later Valentín Albillo published an also equally excellent article about Minimax Polynomial Fit, now just publicly available in his site, which shed some light on the subject and I decided to write a 12cp version.

Ironically, it's been a long time since I don't need a program like this anymore, as now I have three HP-15Cs, one of them I keep in my car, and two HP-42S calculators (the one I like most), one of which I always carry around :-)

Best regards,

Gerson.


Edited: 26 July 2006, 6:18 p.m.


#11

Gerson, don't think we users of 12C are not interested in such programs. The fact is that I personally have a 12C, not a 12CP, and I'm waiting for the 25th Anniversary, which should be able to retain your program.

And I'm an engineer, not involved in the financial world. I use the 12C because I like it!

Great work yours!

-- Antonio


#12

Ciao, Antonio!

Thanks for your remarks. When I said "average HP-12C user" I meant users who use only the financial functions. Of course they never need trigonometric functions in their work.
I have noticed, however, there are some engineers who like the 12C (and the 12CP), perhaps because its the only surviving Voyager, which they once had. Being an engineer myself (though currently I don't work as an engineer - just turned 45, I am still in the military), I know the functions we miss most on the 12C are exactly the trigonometric functions. To these people, this program is addressed. Although engineers generally don't need 10-digit accuracy, I have decided to offer a program as fast and accurate as possible. I will post soon an article with the final version (so I hope) with larger input arguments ranges (for instance, it will be able to compute cos(15725 deg) so easily as cos(245 deg), though in the first case the result will be slightly less accurate. Here are some examples:

Sin(x): 

x (deg) HP-12CP HP-50G HP-15C HP-35
----------------------------------------------------------------------------------
0.000010 1.74532925200E-07 1.74532925199E-07 1.745329252E-07 1.745000000E-07
0.000110 1.91986217720E-06 1.91986217719E-06 1.919862177E-06 1.919800000E-06
0.022000 3.83972426005E-04 3.83972426004E-04 3.839724260E-04 3.839723910E-04
89.99990 9.99999999998E-01 9.99999999998E-01 1.000000000E+00 1.000000000E+00
90.00000 1.00000000000E+00 1.00000000000E+00 1.000000000E+00 1.000000000E+00

ArcTan(x):

x HP-12CP HP-50G HP-15C HP-35
----------------------------------------------------------------------------------
0.00011 6.30253572098E-03 6.30253572102E-03 6.302535721E-03 6.302535688E-03
0.15500 8.81073298598E+00 8.81073298598E+00 8.810732986E+00 8.810732984E+00
0.26795 1.50000431708E+01 1.50000431708E+01 1.500004317E+01 1.500004317E+01
1.00000 4.50000000000E+01 4.50000000000E+01 4.500000000E+01 4.500000000E+01
1.22200 5.07054870168E+01 5.07054870169E+01 5.070548702E+01 5.070548702E+01
99.9990 8.94270555733E+01 8.94270555733E+01 8.942705557E+01 8.942705555E+01
3333333 8.99999828113E+01 8.99999828113E+01 8.999998281E+01 8.999998281E+01
1.1E+12 8.99999999999E+01 8.99999999999E+01 9.000000000E+01 9.000000000E+01

You can notice now I dare compare it with the latest HP calculator, the HP-50G :-)

I hope you'll enjoy it,

Best regards,

Gerson.


Edited: 1 Aug 2006, 10:48 p.m. after one or more responses were posted


#13

Some additional information:

In order to obtain the results in my earlier posting, these coefficients should be used:

	R.2:          2.1E-26    
R.3: 4.47569E-20
R.4: 5.55391606E-14
R.5: 3.281837614E-08 (sine polynomial coefficients)

R.6: -0.0784
R.7: 0.110351
R.8: 0.142838
R.9: 0.199999839 (arctangent polynomial coefficients)

These appear to be slightly better than the previous ones and will likely be included in the final version.
However, the forensics result, that is, the computation of arcsin(arccos(arctan(tan(cos(sin(9 deg)))))),
is slightly worse:
9.00000587986
This is very close to 9.00000588129, for the Elektronika C3-15 (later version) in Mike Sebastian's
Calculator Forensic Results Sorted by Result.
Curiously, my previous coefficients yielded
8.99999979459
Again, very close to 8.99999979443, for the Elektronika C3-15 (early version). Did the designers use the same
algorithm and technique, or is this just a coincidence?


#14

The Program

001- 2 056- * 111- / 166- 0 221- g x=0
002- STO 6 057- RCL .4 112- RCL 9 167- STO 6 222- x<>y
003- Rv 058- + 113- x<>y 168- x<>y 223- x<>y
004- x<>y 059- * 114- g GTO 000 169- 2 224- -
005- STO .0 060- RCL .5 115- / 170- ENTER 225- RCL 5
006- x<>y 061- - 116- g LSTx 171- 3 226- *
007- ENTER 062- * 117- x<>y 172- g SQRT 227- RCL 7
008- g x^2 063- RCL .1 118- g INTG 173- STO 9 228- g x=0
009- g SQRT 064- 3 119- * 174- - 229- g GTO 236
010- 3 065- / 120- g x<=y 175- x<>y 230- x<>y
011- 6 066- + 121- CHS 176- g x<=y 231- CHS
012- 0 067- RCL 8 122- + 177- g GTO 189 232- 9
013- g x<=y 068- * 123- g GTO 007 178- ENTER 233- 0
014- g GTO 115 069- ENTER 124- 0 179- ENTER 234- +
015- Rv 070- g x^2 125- STO 7 180- RCL 9 235- x<>y
016- Rv 071- 4 126- Rv 181- * 236- x<>y
017- 9 072- * 127- x<>y 182- 1 237- RCL .0
018- 0 073- CHS 128- STO .0 183- - 238- x<>y
019- g x<=y 074- 3 129- x<>y 184- x<>y 239- g GTO 000
020- g GTO 024 075- + 130- ENTER 185- RCL 9
021- CHS 076- * 131- g x^2 186- + 240- 1.745329252
022- g x<=y 077- RCL 6 132- 1 187- / 251- EEX
023- g GTO 029 078- 2 133- - 188- 3 252- 2
024- 2 079- g x<=y 134- g x=0 189- 0 253- CHS
025- * 080- g GTO 085 135- g GTO 140 190- STO 8 254- STO .1
026- x<>y 081- Rv 136- CHS 191- x<>y 255- 2.1
027- - 082- g x=0 137- g SQRT 192- STO 9 258- EEX
028- ENTER 083- g GTO 108 138- / 193- g x^2 259- 26
029- Rv 084- g GTO 103 139- g GTO 153 194- ENTER 261- CHS
030- ENTER 085- Rv 140- x<>y 195- ENTER 262- STO .2
031- g x^2 086- x<>y 141- 9 196- ENTER 263- 4.47569
032- g SQRT 087- g GTO 237 142- 0 197- RCL .6 270- EEX
033- ENTER 088- 2 143- * 198- * 271- 20
034- ENTER 089- STO 6 144- g GTO 227 199- RCL .7 273- CHS
035- 9 090- Rv 145- 1 200- + 274- STO .3
036- 0 091- CHS 146- g GTO 125 201- * 275- 5.55391606
037- - 092- 9 147- 0 202- RCL .8 285- EEX
038- g x=0 093- 0 148- STO 7 203- - 286- 14
039- g GTO 045 094- + 149- Rv 204- * 288- CHS
040- Rv 095- g GTO 004 150- x<>y 205- RCL .9 289- STO .4
041- 9 096- STO .0 151- STO .0 206- + 290- 3.281837614
042- 0 097- x<>y 152- x<>y 207- * 301- EEX
043- g x<=y 098- STO 9 153- ENTER 208- 3 302- 8
044- g GTO 015 099- 1 154- g x^2 209- 1/x 303- CHS
045- Rv 100- STO 6 155- g SQRT 210- - 304- STO .5
046- x<>y 101- RCL .0 156- g x=0 211- * 305- .0784
047- STO 8 102- g GTO 007 157- g GTO 227 212- 1 310- CHS
048- g x^2 103- CLx 158- / 213- + 311- STO .6
049- ENTER 104- STO 6 159- STO 5 214- RCL 9 312- .110351
050- ENTER 105- x<>y 160- 1 215- * 319- STO .7
051- ENTER 106- RCL .0 161- g LSTx 216- RCL .1 320- .142838
052- RCL .2 107- g GTO 091 162- g x<=y 217- / 327- STO .8
053- * 108- x<>y 163- g GTO 166 218- RCL 8 328- .199999839
054- RCL .3 109- RCL .0 164- 1/x 219- + 338- STO .9
055- - 110- x<>y 165- 9 220- RCL 6 339- g GTO 000

Usage

SIN: R/S
COS: g GTO 088 R/S
TAN: g GTO 096 R/S
ASIN: g GTO 124 R/S
ACOS: g GTO 145 R/S
ATAN: g GTO 147 R/S

g GTO 240 R/S: If available, this loads all constants needed by the program.

Input ranges

SIN, COS, TAN: |x| =< 1E11
ASIN, ACOS: |x| =< 1
ATAN: |x| =< 9.99999999E49

Running times

SIN, COS: 2.4 s
TAN: 4.7 s
ASIN, ACOS: 2.5 s

Comparison with other HP calculators

Sin(x):

x (deg) HP-12CP HP-50G HP-15C HP-35
----------------------------------------------------------------------------------
0.000000 0.00000000000E+00 0.00000000000E+00 0.000000000E+00 0.000000000E+00
0.000010 1.74532925200E-07 1.74532925199E-07 1.745329252E-07 1.745000000E-07
0.000110 1.91986217720E-06 1.91986217719E-06 1.919862177E-06 1.919800000E-06
0.022000 3.83972426005E-04 3.83972426004E-04 3.839724260E-04 3.839723910E-04
3.330000 5.80867495981E-02 5.80867495977E-02 5.808674960E-02 5.808674960E-02
14.44000 2.49366025116E-01 2.49366025115E-01 2.493660251E-01 2.493660250E-01
25.55000 4.31298587031E-01 4.31298587031E-01 4.312985870E-01 4.312985871E-01
36.66000 5.97065256389E-01 5.97065256389E-01 5.970652564E-01 5.970652561E-01
47.77000 7.40452782677E-01 7.40452782677E-01 7.404527827E-01 7.404527828E-01
58.88000 8.56086728293E-01 8.56086728292E-01 8.560867283E-01 8.560867285E-01
69.99000 9.39632912698E-01 9.39632912698E-01 9.396329127E-01 9.396329127E-01
81.11000 9.87986852782E-01 9.87986852778E-01 9.879868528E-01 9.879868527E-01
88.88000 9.99808950037E-01 9.99808950038E-01 9.998089500E-01 9.998089499E-01
89.99900 9.99999999848E-01 9.99999999848E-01 9.999999998E-01 9.999999998E-01
89.99990 9.99999999998E-01 9.99999999998E-01 1.000000000E+00 1.000000000E+00
90.00000 1.00000000000E+00 1.00000000000E+00 1.000000000E+00 1.000000000E+00

Tan(x):

x (deg) HP-12CP HP-50G HP-15C HP-35
----------------------------------------------------------------------------------
0.000000 0.00000000000E+00 0.00000000000E+00 0.000000000E+00 0.000000000E+00
0.000010 1.74532925200E-07 1.74532925199E-07 1.745329252E-07 1.745000000E-07
0.000110 1.91986217721E-06 1.91986217720E-06 1.919862177E-06 1.919800000E-06
0.022000 3.83972454310E-04 3.83972454309E-04 3.839724543E-04 3.839724542E-04
3.330000 5.81849926709E-02 5.81849926706E-02 5.818499267E-02 5.818499260E-02
14.44000 2.57500649118E-01 2.57500649118E-01 2.575006491E-01 2.575006490E-01
25.55000 4.78047179798E-01 4.78047179799E-01 4.780471798E-01 4.780471798E-01
36.66000 7.44291588299E-01 7.44291588300E-01 7.442915883E-01 7.442915880E-01
47.77000 1.10168657755E+00 1.10168657755E+00 1.101686578E+00 1.101686578E+00
58.88000 1.65641139080E+00 1.65641139081E+00 1.656411391E+00 1.656411391E+00
69.99000 2.74598611677E+00 2.74598611678E+00 2.745986117E+00 2.745986119E+00
81.11000 6.39316645081E+00 6.39316645080E+00 6.393166451E+00 6.393166426E+00
88.88000 5.11504299317E+01 5.11504299320E+01 5.115042993E+01 5.115042860E+01
89.99900 5.72957795071E+04 5.72957795073E+04 5.729577951E+05 5.729655162E+04
89.99990 5.72957795128E+05 5.72957795130E+05 5.729577951E+05 5.730193057E+05
90.00000 Error 0 TAN Error 9.999999999E+99 9.999999999E+99

ArcTan(x):

x HP-12CP HP-50G HP-15C HP-35
----------------------------------------------------------------------------------
0.00000 0.00000000000E+00 0.00000000000E+00 0.000000000E+00 0.000000000E+00
0.00011 6.30253572098E-03 6.30253572102E-03 6.302535721E-03 6.302535688E-03
0.15500 8.81073298598E+00 8.81073298598E+00 8.810732986E+00 8.810732984E+00
0.26795 1.50000431708E+01 1.50000431708E+01 1.500004317E+01 1.500004317E+01
0.41421 2.24998257819E+01 2.24998257819E+01 2.249982578E+01 2.249982579E+01
0.57735 2.99999884325E+01 2.99999884324E+01 2.999998843E+01 2.999998843E+01
0.77700 3.78472067673E+01 3.78472067673E+01 3.784720677E+01 3.784720676E+01
0.88800 4.16050764577E+01 4.16050764579E+01 4.160507646E+01 4.160507646E+01
1.00000 4.50000000000E+01 4.50000000000E+01 4.500000000E+01 4.500000000E+01
1.22200 5.07054870168E+01 5.07054870169E+01 5.070548702E+01 5.070548702E+01
1.48880 5.61114572284E+01 5.61114572285E+01 5.611145723E+01 5.611145722E+01
2.11100 6.46526573517E+01 6.46526573518E+01 6.465265735E+01 6.465265735E+01
4.88800 7.84378235856E+01 7.84378235855E+01 7.843782359E+01 7.843782360E+01
7.55500 8.24600068273E+01 8.24600068272E+01 8.246000683E+01 8.246000679E+01
99.9990 8.94270555733E+01 8.94270555733E+01 8.942705557E+01 8.942705555E+01
3333333 8.99999828113E+01 8.99999828113E+01 8.999998281E+01 8.999998281E+01
1.1E+12 8.99999999999E+01 8.99999999999E+01 9.000000000E+01 9.000000000E+01

------

Edited to change mod 360 routine (lines 114-123) so the input range for SIN, COS and TAN is extended to +/- 1E11.
Now the entry-points of SIN, COS and TAN begin with 0 opposed to the inverse functions which begin with 1, making them somewhat easier to remember (and if we remember that COS was above the '8' key and TAN above the '9' key on some older calculators, we have another digit: COS 088, TAN 096).

------

Before posting a more detailed article, I'd like to receive some feedbacks about which 12C Platinum versions should run this program. The program was tested on the 12Cp 25th Anniversion Edition, but it should run on all versions. Some early versions had a bug which didn't allow lines greater than 255, but this is not a problem since lines 240-339 are optional.

Thanks,

Gerson.

-----------
Changed line 123 to g GTO 007 (previously g GTO 017). See Articles Forum.


Edited: 6 Aug 2006, 3:28 p.m.


Possibly Related Threads...
Thread Author Replies Views Last Post
  How much faster is the HP Prime than the HP 50g ? Michael de Estrada 13 921 11-13-2013, 07:38 AM
Last Post: DeboT
  HP Prime - CAS functions in Spreadsheet App CR Haeger 6 661 11-11-2013, 12:37 AM
Last Post: Michael de Estrada
  [41CL] New Extra Functions version Monte Dalrymple 0 275 11-08-2013, 04:32 PM
Last Post: Monte Dalrymple
  HP Prime: Long integers (continued) Helge Gabert 2 365 11-07-2013, 11:24 AM
Last Post: Helge Gabert
  HP 12C Platinum Programming v. Gold Face Dean Lewis 10 868 11-03-2013, 07:30 PM
Last Post: Kimberly Thompson
  HP Prime: Pass "Long" Integers to a Program Helge Gabert 6 651 11-03-2013, 01:12 PM
Last Post: Helge Gabert
  HP Prime polynomial long division bluesun08 13 979 10-30-2013, 03:29 AM
Last Post: parisse
  HP Prime: in need of help with defining functions Alberto Candel 14 1,108 10-27-2013, 10:48 AM
Last Post: Alberto Candel
  HP Prime spreadsheet functions SanS 0 617 10-04-2013, 04:23 AM
Last Post: SanS
  Stats functions on the HP34S Nicholas van Stigt 5 524 09-24-2013, 02:45 AM
Last Post: Nick_S

Forum Jump: