Useful only on the HP-17B II, but might be a good equation test anyway. I am glad it is working now (it wasn’t two months ago or I had done something wrong).
Code:
IF(S(SIN):(-1)^INT(X÷180+0×L(X:MOD(X:180)×PI÷180))×(2×Σ(K:1:21:4:X^K÷FACT(K))-(EXPM1(X)-EXPM1(-X))÷2)-SIN:IF(S(COS):COS-(-1)^INT(X÷180+0×L(X:MOD(X:180)×PI÷180))×(2×Σ(K:4:20:4:X^K÷FACT(K))+1-(EXPM1(X)+EXPM1(-X))÷2):IF(S(TAN):TAN-(0×L(X:MOD(X:180)×PI÷180)+4×Σ(K:1:21:4:X^K÷FACT(K))-EXPM1(X)+EXPM1(-X))÷(4×Σ(K:4:20:4:X^K÷FACT(K))+2-EXPM1(X)-EXPM1(-X)):IF(S(DEG):X×180÷PI-DEG:IF(S(RAD):X×PI÷180-RAD: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)+(X-1)/(X+1):X+L(V:0))))+(G(Q)+G(A)×(4×Σ(K:1:29:4:X^K÷K)-LNP1(2×X÷(1-X))+G(V)))×G(B)×90÷PI):IF(S(ACOS):ACOS-(0×(L(X:IF(X<>-1:SQRT((1-X)÷(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)+(X-1)÷(X+1):X+L(V:0))))+(G(Q)+G(A)×(4×Σ(K:1:29:4:X^K÷K)-LNP1(2×X÷(1-X))+G(V)))×(3-G(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)+(X-1)÷(X+1):X+L(V:0))))+(G(Q)+G(A)×(4×Σ(K:1:29:4:X^K÷K)-LNP1(2×X÷(1-X))+G(V)))×G(B)×90÷PI))))))))
Forensic tests:
8,999999999999999999999999985917536 (X = 9 degrees)
8,999999999994430907634826729950962 (X = 171 degrees)