Jump to content

Trigonometric functions: Difference between revisions

m
→‎{{header|REXX}}: added further normalization for degrees to radians that was omitted.
(→‎{{header|PARI/GP}}: added functional version)
m (→‎{{header|REXX}}: added further normalization for degrees to radians that was omitted.)
Line 1,982:
│ than the desired digits, as specified by the SHOWDIGS variable. │
└──────────────────────────────────────────────────────────────────────────┘</lang>
Most math (POW, EXP, LOG, LN, GAMMA, etc.), trigonometictrigonometric, and hyperbolic functions need only five extra digits, but ten
<br>extra digits is safer in case the argument is close to an asymptotic point or a multiple or fractional part of pi or somesuch.
<br>It should also be noted that both the '''pi''' and '''e''' constants have only around 77 decimal digits as included here, if more
Line 2,061:
tan: procedure; arg x; _=cos(x); if _=0 then call tanErr; return sin(x)/_
tanD: return tan(d2r(arg(1)))
d2d: return arg(1)//360 /*normalize degrees►1 unit circle*/
d2r: return r2r(d2d(arg(1))*pi()/180) /*convert degrees ──► radians. */
r2d: return d2d((arg(1)*180/pi())) /*convert radians ──► degrees. */
r2r: return arg(1)//(pi()*2) /*normalize radians►1 unit circle*/
show: return left(left('',arg(1)>=0)format(arg(1),,showdigs)/1,showdigs)
tellErr: say; say '*** error! ***'; say; say arg(1); say; exit 13
Cookies help us deliver our services. By using our services, you agree to our use of cookies.