Posts: 2,761
Threads: 100
Joined: Jul 2005
For this equation to be any practical, the HP17BII ought to have twice as much memory and to be at least ten times as fast. The equation takes about 50 seconds to verify (this is done only once for each "trig session", however. The individual trig equations take longer to evaluate as they get deeper in the if structure (SIN and COS take less than 2 seconds, TAN takes 3 seconds, but ATAN takes about 10 seconds).
Before starting a new "trig session", the variables have to be deleted, otherwise the calculator will run out of memory during the verification process.
Here is the listing, even though I doubt anyone will ever key that in :)
A better idea would be using the same structure and shorter equations with limited range [pi..pi], with arguments and outputs in radians (instead of degrees and full range).
Posts: 248
Threads: 5
Joined: Feb 2008
Posts: 858
Threads: 80
Joined: Feb 2009
I'd like to verify your timing in an emulated 17b2 and for that I tried to OCR this printer strip (as Christoph's Emu42 may use it). Alas the output is not of much help.
IF (S (SIN ): (12XIP (
:36~ )~lS9 » ) x (2X! (K:l~ 21
:<f: (L(Fl:MO() ( X: lSld ) XPI:18
to show just the first 3 lines. So I do not migrate it.
Ciao.....Mike
Posts: 2,761
Threads: 100
Joined: Jul 2005
Here is the forensic test sequence, as an example of usage:
Keystrokes Display corresponding
HP42S results
9 X X=9
SIN SIN=1.56434465037E1 0.15643446504
STO X COS COS=0.99999627274 9.99996272743E1
STO X TAN TAN=1.74549998542E2 1.74549998555E2
STO X MORE ATAN ATAN=9.99996272875E1 9.99996272744E1
MORE STO X MORE ACOS ACOS=1.56431692694E1 1.56434441642E1
MORE STO X MORE ASIN ASIN=8.99983917628 8.99999864267
More examples:
3.14 X=3.14
R~D R~D=179.908747671
STO X TAN TAN=1.59265491996E3 tan(3.14 rad)
123456789 COS COS=0.98768834058
777777777717 +/ X SIN SIN=5.2335956241E2
Last and most importantly, the listing in text format:
IF(S(SIN):(12*IP((MOD(X:360)/180)))*(2*SIGMA(K:1:21:4:(L(A:
MOD(X:180)*PI/180))^K/FACT(K))(EXP(G(A))EXP(G(A)))/2)SIN
:IF(S(COS):COS((12*IP((MOD(X+90:360)/180)))*(2*SIGMA(K:1:
21:4:(L(A:MOD(X+90:180)*PI/180))^K/FACT(K))(EXP(G(A))EXP(
G(A)))/2)):IF(S(TAN):TAN((2*SIGMA(K:1:21:4:(L(A:MOD(X:180)*
PI/180))^K/FACT(K))(EXP(G(A))EXP(G(A)))/2)/(2*SIGMA(
K:4:20:4:G(A)^K/FACT(K))+2(EXP(G(A))+EXP(G(A)))/2)):IF(S(
R~D):X*180/PIR~D:IF(S(ASIN):ASIN(0*(L(B:SGN(X))+L(X:ABS(X))
+0*L(F:IP(X)+1)+L(X:IF(X<>1:X/SQRT(1SQ(X)):X))+L(X:IF(X<1:L(
A:1)*X+L(Q:0):0*(L(Q:PI)+L(A:1))+INV(X)))+L(X:IF(X>SQRT(2)
1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))))+(G(Q)+G(A)*(4*SIGMA(
K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(F)*G(B)*90/PI):IF(S(
ACOS):ACOS(0*(L(X:IF(X<>1:L(F:1)*SQRT((1X)/(1+X)):0*L(F:
2)+X))+L(B:SGN(X))+L(X:ABS(X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0*(
L(Q:PI)*L(A:1))+INV(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X
1)/(X+1):X+L(V:0))))+(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((
1+X)/(1X))+G(V)))*G(F)*G(B)*180/PI):ATAN(0*(L(B:SGN(X))+L(
X:ABS(X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0*(L(Q:PI)+L(A:1))+INV(
X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))))+(
G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(
B)*90/PI)))))))
Cheers,
Gerson.
Posts: 355
Threads: 67
Joined: Nov 2005
A Emu42 State file for a 17BII English ROM rev. B with the equation is available here: http://www.hpmuseum.org/guest/cgiesse/17b2trig.zip
PS. The state file has been replaced by a later version used in this thread.
Edited: 19 Apr 2013, 12:51 p.m. after one or more responses were posted
Posts: 2,761
Threads: 100
Joined: Jul 2005
Thank you! Until this morning this long equation resided only in the memory of my physical HP17B II, although I had most individual equations either on my HP200LX or in the CPACK200 SOLVE.EQN file. I installed Emu42 this morning, but decided to use CPACK200 to edit the equation. Transferring it to the Emu42 was going to be the next step, so it was a pleasant surprise when I woke up and saw you had already done that. Thanks again! Interestingly, on Emu42 I don't have to delete the equation variables after leaving the solver. I extracted the ROM image from an HP17BII I don't have anymore. The serial number of my current HP17B is 3518S07942. Like the one I sold, this is a noninternational model. The available memory, when using the solver, is 2559 bytes (37%) and 2603 bytes (38%) on the emulator. When I leave the solver these change to 5287 (78%) and 5331(78%), respectively. It is a very small difference, yet I continue to get a "INSUFFICIENT MEMORY" message when I press CALC again on the calculator, unless I delete the equation variables. I've tried clearing DATA and the registers. No problem on the emulator, even under "Authentic Calculator Speed". Different ROMs, perhaps?
I feel tempted to try a longer and more accurate TAN equation, but I think this is good enough for practical purposes :)
Edited: 16 Apr 2013, 1:40 p.m.
Posts: 355
Threads: 67
Joined: Nov 2005
To check the ROM revision:
 Select "File/Settings..." and check the "Authentic Calculator Speed" option
 Press <ON>+<SK4> together to enter the test mode
 Press < < > to enter the memory scanner
 Press <.> to evaluate the displayed address
You see the ROM revision in the left corner for about 3s, im my case the two letters "BA". The first letter is standing for the main ROM rev., the 2nd for the international expanded ROM rev.
To leave the scanner press <ON>+<SK3> together.
Posts: 2,761
Threads: 100
Joined: Jul 2005
Thanks! Mine is B0 and my ROM image is B3. I was thinking of going for another B3 version (and the hassle of keying all that in again), but after MACHINE RESET after the fourth step (which doesn't delete the solver equations) I noticed the calculator is behaving like the emulator. I still have the same slightly different memory amounts reported earlier, but I don't have to delete the variables prior to entering SOLVE anymore. Apparently the machine reset has removed whatever was causing the problem.
Posts: 2,309
Threads: 116
Joined: Jun 2005
Isn't the digit the reset log, rather than being part of the revision?
Posts: 2,761
Threads: 100
Joined: Jul 2005
So they are both the same version B. The digits were in the rightmost side of the screen. Sorry for the confusion!
Edited: 16 Apr 2013, 3:09 p.m.
Posts: 40
Threads: 5
Joined: Oct 2008
Monster!
Please forgive my ignorance (particularly when it comes to the L and G functions  I'm not a skilled programmer type, and I read somewhere that these are a bit different between the variations of the 17B machines)  has this equation been tested on the 17bII+ machines?
If not then I guess I will have to try it and see!
Posts: 2,761
Threads: 100
Joined: Jul 2005
Quote:
Monster!
It does look cryptic, the way it is written. It would look less scary if properly formatted. For instance, take a look at the following parallel between equivalent BASIC and the HP17B Solver language codes. This is from a similar ATAN implementation.

CLS
DEFDBL AM, OZ
DEFINT N, S
PI = 4 * ATN(1)
INPUT X
S1 = SGN(X): X = ABS(X)
IF X < 1 THEN
X = X
S2 = 1: K1 = 0
ELSE
X = 1 / X
S2 = 1: K1 = PI / 2
END IF
IF X > (2  SQR(3)) THEN
X = (X * SQR(3)  1) / (X + SQR(3))
K2 = PI / 6
ELSE
X = X
K2 = 0
END IF
SUM# = 0
FOR N = 0 TO 12
SUM# = SUM# + (1) ^ N * X ^ (2 * N + 1) / (2 * N + 1)
NEXT N
ATAN = (K1 + S2 * (K2 + SUM#)) * S1 * 180 / PI
PRINT ATAN

ATAN=
0*(L(S1:SGN(X))+L(X:ABS(X))+
L(X:IF(X<1:
L(S2:1)*X+L(K1:0)
:
0*(L(K1:PI/2)+L(S2:1))+1/X))+
L(X:IF(X>2SQRT(3):
0*L(K2:PI/6)+(X*SQRT(3)1)/(X+SQRT(3))
:
X+L(K2:0))))+
(G(K1)+G(S2)*(SIGMA(N:0:9:1:(1)^N*X^(2*N+1)/(2*N+1))+G(K2)))*G(S1)*180/PI

As you can see from the example, L stands for "LET" (that is, it is the attribute instruction). Likewise G stands for GET, which is used when the "gotten" variable shouldn't appear in the equations variable list.
There is an issue related to the L() and G() instructions on the HP17BII+ which stops it from working correctly for certain equations, but I don't know exactly what it is. I only remember having read about this problem in the forum. Also, it appears there is a precedence problem with the exponentiation operator, judging from the last message in the following old thread:
http://www.hpmuseum.org/cgisys/cgiwrap/hpmuseum/archv013.cgi?read=41253
By what I can remember, there are workarounds for the L() and G() problem, but I can't find them right now. It would be nice if someone ported the equation to the plus model, given its speed and larger memory. Perhaps you could test it on a small equation first.
Regards,
Gerson.
Posts: 858
Threads: 80
Joined: Feb 2009
Posts: 764
Threads: 118
Joined: Aug 2007
That is a long equation. Extraordinary!
Posts: 247
Threads: 26
Joined: Oct 2007
So what you're saying is that the time it takes to actually use this equation is longer than would be required to just dig up a scientific model elsewhere in the house? I commonly ran into the same problem when tinkering with lengthy 17BII equations.
Posts: 2,761
Threads: 100
Joined: Jul 2005
Entering this long equation into the calculator at a time is very prone to errors. Even worst, spotting these errors would be very time consuming, if not impossible at all.So, I would suggest the strategy I have used:
Enter this small equation with placeholders for the other missing partial equations:
IF(S(SIN):(X)SIN:IF(S(COS):COS(X):IF(S(TAN):TAN(X):IF(S(R~D):X*
180/PIR~D:IF(S(ASIN):ASIN(X):IF(S(ACOS):ACOS(X):ATAN(X)))))))
If there are no errors, replace the first X with the other side of the sine equation:
12*IP((MOD(X:360)/180)))*(2*SIGMA(K:1:21:4:(L(A:MOD
(X:180)*PI/180))^K/FACT(K))(EXP(G(A))EXP(G(A)))/2
The equation now becomes:
IF(S(SIN):(12*IP((MOD(X:360)/180)))*(2*SIGMA(K:1:21:4:(L(A
:MOD(X:180)*PI/180))^K/FACT(K))(EXP(G(A))EXP(G(A)))/2)
SIN:IF(S(COS):COS(X):IF(S(TAN):TAN(X):IF(S(R~D):X*180/PI
R~D:IF(S(ASIN):ASIN(X):IF(S(ACOS):ACOS(X):ATAN(X)))))))
When occasional mistakes are corrected, proceed likewise with the other functions, one at a time:
cosine:
(12*IP((MOD(X+90:360)/180)))*(2*SIGMA(K:1:21:4:(L(A:MOD
(X+90:180)*PI/180))^K/FACT(K))(EXP(G(A))EXP(G(A)))/2)
tangent:
(2*SIGMA(K:1:21:4:(L(A:MOD(X:180)*PI/180))^K/FACT
(K))(EXP(G(A))EXP(G(A)))/2)/(2*SIGMA(K:4:20:
4:G(A)^K/FACT(K))+2(EXP(G(A))+EXP(G(A)))/2)
arcsine:
0*(L(B:SGN(X))+L(X:ABS(X))+0*L(F:IP(X)+1)+L(X:IF(X<>1:X/SQRT(1SQ
(X)):X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0*(L(Q:PI)+L(A:1))+INV(X)))+
L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))))+(G(Q)+G(A)
*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(F)*G(B)*90/PI
arccosine:
0*(L(X:IF(X<>1:L(F:1)*SQRT((1X)/(1+X)):0*L(F:2)+X))+L(B:SGN(X))+
L(X:ABS(X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0*(L(Q:PI)*L(A:1))+INV(X))
)+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))))+(G(Q)+G(A
)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(F)*G(B)*180/PI
arctangent:
0*(L(B:SGN(X))+L(X:ABS(X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0* (L(Q:PI)+L(A:
1))+INV(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))))+
(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(B)*90/PI
If this is your only solver equation, you shouldn't get a "INSUFFICIENT MEMORY" message when the equation is verified. If this happens, do a MACHINE RESET: press the ON key and the third softkey together. The already entered equation won't be lost.
When you're done, test each function for a few arguments distributed along its basic range. If you get a wrong result, check the respective partial equation for mistakes like wrong operators (+ instead of * or > instead of <, for instance).
Posts: 2,761
Threads: 100
Joined: Jul 2005
It shouldn't be difficult to key it in, however (see below). It wouldn't require more than a couple of hours at Starbucks on a Sunday morning :)
Posts: 2,761
Threads: 100
Joined: Jul 2005
Not when the equation has already been entered :) Actually this should be useful only to people who have only one calculator, the HP17BII, and would need to do some trigs occasionally. Very few people, I recognize :)
Posts: 149
Threads: 7
Joined: Dec 2006
Excellent suggestion! I've often avoided entering long solver equations because of how easy it is to make a mistake, thinking the only choice was to enter the entire thing at the same time.
Entering it in stages makes perfect sense. Thanks.
Posts: 355
Threads: 67
Joined: Nov 2005
People who know me, know also that I haven't typed in the equation manually into the emulated 17BII. Therefore I'm too much an engineer.
So how I done it. First copied Gerson's text version into an ASCII file named EQU.TXT.
The mk17mac.zip package contain two programs I used AGFILTER.exe and Asc17mac.exe.
With AGFILTER < EQU.TXT > EQU.ASC I replaced the asterisk and slash characters by the correct cross and division symbol. Then I replaced the 'SIGMA' text with a small 's' with a ASCII text editor. The small 's' is a replacement for the sigma character in ASCII files when using Asc17mac. Then with Asc17mac < EQU.ASC > EQU.MAC I generated a keyboard macro file for Emu42.
Finally I started a new 17BII session created a new empty equation and then starting with "Tools/Macro/Play..." and the file EQU.MAC the "type in" process. And then I would go to Starbucks, but there's no one in the Black Forrest, and will let the computer do the rest... ;)
Ops, I forgot to press the <Input> key and the end.
Posts: 2,761
Threads: 100
Joined: Jul 2005
In order to make room for D~R (Degrees to Radians Conversion), some optimizations have been made. The same instructions in the previous post apply to the new equations, that is, every underlined X in the first equation should be replaced by the proper equation, one at time:
IF(S(SIN):XSIN:IF(S(COS):COSX:IF(S(TAN):TANX:IF(S(R~D):X*180/PIR~D:IF(S
(ASIN):ASIN(X):IF(S(ACOS):ACOS(X):IF(S(ATAN):ATAN(X):X*PI/180D~R)))))))
sine:
(0.5IDIV(MOD(X:360):180))*(4*SIGMA(K:1:21:4:(L(A:
MOD(X:180)*PI/180))^K/FACT(K))EXP(G(A))+EXP(G(A)))
cosine:
(0.5IDIV(MOD(X+90:360):180))*(4*SIGMA(K:1:21:4:(L(A:
MOD(X+90:180)*PI/180))^K/FACT(K))EXP(G(A))+EXP(G(A)))
tangent
(SIGMA(K:1:21:4:(L(A:MOD(X:180)*PI/180))^K/FACT(K))(EXP(G(A))EXP(
G(A)))/4)/(SIGMA(K:4:20:4:G(A)^K/FACT(K))+1(EXP(G(A))+EXP(G(A)))/4)
arcsine:
0*(L(B:SGN(X)+IP(X))+L(X:ABS(X))+L(X:IF(X<>1:X/SQRT(1SQ(X)):X))+L(X:IF(X<1:L(A:1)
*X+L(Q:0):0*(L(Q:PI)+L(A:1))+INV(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):
X+L(V:0))))+(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(B)*90/PI
arccosine:
0*(L(X:IF(X<>1:SQRT((1X)/(1+X)):X))+L(B:SGN(X))+L(X:ABS(X))+L(X:IF(X<1:L(A:1)*X+
L(Q:0):0*(L(Q:PI)*L(A:1))+INV(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L
(V:0))))+(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*(3G(B))*90/PI
arctangent:
0*(L(B:SGN(X))+L(X:ABS(X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0*(L(Q:PI)+L(A:
1))+INV(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))))+
(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(B)*90/PI
Here is the complete equation:
IF(S(SIN):(INV(2)IDIV(MOD(X:360):180))*(4*SIGMA(K:1:21:4:(L(A:
MOD(X:180)*PI/180))^K/FACT(K))EXP(G(A))+EXP(G(A)))SIN:IF(S
(COS):COS(INV(2)IDIV(MOD(X+90:360):180))*(4*SIGMA(K:1:21:4:(L(
A:MOD(X+90:180)*PI/180))^K/FACT(K))EXP(G(A))+EXP(G(A))):IF(
S(TAN):TAN(SIGMA(K:1:21:4:(L(A:MOD(X:180)*PI/180))^K/FACT(K)
)(EXP(G(A))EXP(G(A)))/4)/(SIGMA(K:4:20:4:G(A)^K/FACT(K))+1
(EXP(G(A))+EXP(G(A)))/4):IF(S(R~D):X*180/PIR~D:IF(S(ASIN):
ASIN(0*(L(B:SGN(X)+IP(X))+L(X:ABS(X))+L(X:IF(X<>1:X/SQRT(1
SQ(X)):X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0*(L(Q:PI)+L(A:1))+INV
(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))))+
(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(
B)*90/PI):IF(S(ACOS):ACOS(0*(L(X:IF(X<>1:SQRT((1X)/(1+X)):
X))+L(B:SGN(X))+L(X:ABS(X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0*(L(Q
:PI)*L(A:1))+INV(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(
X+1):X+L(V:0))))+(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)
/(1X))+G(V)))*(3G(B))*90/PI):IF(S(ATAN):ATAN(0*(L(B:SGN(X)
)+L(X:ABS(X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0*(L(Q:PI)+L(A:1))+
INV(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))
))+(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))
*G(B)*90/PI):X*PI/180D~R)))))))
That's exactly the text I've used to create a macro for Emu42. Just follow Christoph Giesselink's instructions elsewhere in this thread.
Approximate running times on the real HP17BII:
SIN: 1.8 s
COS: 1.8 s
TAN: 2.9 s
R~D: 2.1 s
ASIN: 4.5 s
ACOS: 7.0 s
ATAN: 9.5 s
D~R: 10.5 s
D~R is there just for the lazy ones like me. PI shift MTH PI * 180 / EXIT is much faster than X STO MORE R~D :) If D~R is used quite often, perhaps it should be better to place it just after R~D, in the beginning of the second menu line (but this might delay the inverse functions a bit more). The equation verification time is about 50 seconds (only a few tenths of seconds on the emulator), but this has to be done only in the beginning of a solver session. Notice you can leave the solver (without pressing the EXIT key), go to the MTH menu and back to the solver (by pressing EXIT) as many time as needed, which makes the HP17BII with this equation a somewhat convenient basic scientific calculator.
 P.S.: I've changed the constants 0.5 in the complete equation above to INV(2) in order to avoid an "INVALID EQUATION" error when the radix mark is comma. Otherwise it would be necessary to edit the equation manually to change both instances of the constant to 0,5. It appears INV(2) takes up a few bytes less than 0.5, but I still have to check this out.
Edited: 19 Apr 2013, 2:37 a.m.
Posts: 2,761
Threads: 100
Joined: Jul 2005
Posts: 2,761
Threads: 100
Joined: Jul 2005
You're welcome, Ken!
Once again I had a chance to test this method and can confirm it works. I said this equation turned the HP17BII into a somewhat convenient basic scientific calculator. Well, I think I will reconsider this: yesterday I got an unexpected "MEMORY LOST" message without any apparent reason (except perhaps the cheap brandless batteries I am using :)
I took the time to optimize the equations even further. About 200 bytes have been saved when compared to the first version:
IF(S(SIN):XSIN:IF(S(COS):COSX:IF(S(TAN):TANX:IF(S(R~D):X*180/PIR~D:IF(S
(D~R):X*PI/180D~R:IF(S(ASIN):ASIN(X):IF(S(ACOS):ACOS(X):ATAN(X))))))))
sine:
(1)^INT(X/180+0*L(X:MOD(X:180)*PI/180))*(2*
SIGMA(K:1:21:4:X^K/FACT(K))(EXP(X)EXP(X))/2)
cosine:
(1)^INT(X/180+0*L(X:MOD(X:180)*PI/180))*(2*SIGMA
(K:4:20:4:X^K/FACT(K))+2(EXP(X)+EXP(X))/2)
tangent
(0*L(X:MOD(X:180)*PI/180)+4*SIGMA(K:1:21:4:X^K/FACT(K))EXP(
X)+EXP(X))/(4*SIGMA(K:4:20:4:X^K/FACT(K))+4EXP(X)EXP(X))
arcsine:
0*(L(B:SGN(X)+IP(X))+L(X:ABS(X))+L(X:IF(X<>1:X/SQRT(1SQ(X)):X))+L(X:IF(X<1:L(A:1)
*X+L(Q:0):0*(L(Q:PI)+L(A:1))+INV(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):
X+L(V:0))))+(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(B)*90/PI
arccosine:
0*(L(X:IF(X<>1:SQRT((1X)/(1+X)):X))+L(B:SGN(X))+L(X:ABS(X))+L(X:IF(X<1:L(A:1)*X+
L(Q:0):0*(L(Q:PI)*L(A:1))+INV(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L
(V:0))))+(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*(3G(B))*90/PI
arctangent:
0*(L(B:SGN(X))+L(X:ABS(X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0*(L(Q:PI)+L(A:
1))+INV(X)))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))))+
(G(Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(B)*90/PI
Complete equation:
IF(S(SIN):(1)^INT(X/180+0*L(X:MOD(X:180)*PI/180))*(2*SIGMA(K
:1:21:4:X^K/FACT(K))(EXP(X)EXP(X))/2)SIN:IF(S(COS):COS(
1)^INT(X/180+0*L(X:MOD(X:180)*PI/180))*(2*SIGMA(K:4:20:4:X^K/
FACT(K))+2(EXP(X)+EXP(X))/2):IF(S(TAN):TAN(0*L(X:MOD(X:180
)*PI/180)+4*SIGMA(K:1:21:4:X^K/FACT(K))EXP(X)+EXP(X))/(4*
SIGMA(K:4:20:4:X^K/FACT(K))+4EXP(X)EXP(X)):IF(S(R~D):X*180
/PIR~D:IF(S(D~R):X*PI/180D~R:IF(S(ASIN):ASIN(0*(L(B:SGN(X)
+IP(X))+L(X:ABS(X))+L(X:IF(X<>1:X/SQRT(1SQ(X)):X))+L(X:IF(X<
1:L(A:1)*X+L(Q:0):0*(L(Q:PI)+L(A:1))+INV(X)))+L(X:IF(X>SQRT(
2)1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))))+(G(Q)+G(A)*(4*SIGMA(
K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*G(B)*90/PI):IF(S(ACOS)
:ACOS(0*(L(X:IF(X<>1:SQRT((1X)/(1+X)):X))+L(B:SGN(X))+L(X:
ABS(X))+L(X:IF(X<1:L(A:1)*X+L(Q:0):0*(L(Q:PI)*L(A:1))+INV(X)
))+L(X:IF(X>SQRT(2)1:0*L(V:PI/2)+(X1)/(X+1):X+L(V:0))))+(G(
Q)+G(A)*(4*SIGMA(K:1:29:4:X^K/K)LN((1+X)/(1X))+G(V)))*(3G(
B))*90/PI):ATAN(0*(L(B:SGN(X))+L(X:ABS(X))+L(X:IF(X<1:L(A:1)
*X+L(Q:0):0*(L(Q:PI)+L(A:1))+INV(X)))+L(X:IF(X>SQRT(2)1:0*L
(V:PI/2)+(X1)/(X+1):X+L(V:0))))+(G(Q)+G(A)*(4*SIGMA(K:1:29:4
:X^K/K)LN((1+X)/(1X))+G(V)))*G(B)*90/PI))))))))
Running times:
SIN: 1.8 s
COS: 1.6 s
TAN: 2.6 s
R~D: 2.0 s
D~R: 2.7 s
ASIN: 5.2 s
ACOS: 8.1 s
ATAN: 10.9 s
Ranges:
SIN, COS, TAN: 999 999 999 999 to 999 999 999 999 ^{1}
ASIN & ACOS: 1 to 1
ATAN: 1E11 < X <= 9.99999999999E499 ^{2}
^{1} For odd multiples of 90 degrees, TAN returns 249999999996, which should be regarded as infinity
^{2} Exponents equal or greater than 18 will cause UNDERFLOW, but the results will be correct (either 90 or +90 degrees)
Hopefully no more changes :)
