Trigonometric functions: Difference between revisions

→‎{{header|REXX}}: boxed the technique used here to aid novice programmers in ripping code. -- ~~~~
m (→‎{{header|REXX}}: used a simplier form of ''numeric form''. -- ~~~~)
(→‎{{header|REXX}}: boxed the technique used here to aid novice programmers in ripping code. -- ~~~~)
Line 1,619:
The REXX language doesn't have any trig functions (or for that matter, a square root [SQRT] function), so if higher math
<br>functions are wanted, you have to roll your own. Some of the normal/regular trigonometric functions are included here.
<lang rexx> ┌──────────────────────────────────────────────────────────────────────────┐
<br><br>One common method to ensure enough precision in REXX is to specify more digits (via NUMERIC DIGITS nnn) than is needed,
│ One common method that ensures enough accuracy in REXX is specifying │
<br>and then only display the number of digits that is desired, or the number(s) could be re-normalized with the FORMAT bif.
│ more precision (via NUMERIC DIGITS nnn) than is needed, and │
<br><br>Most math (POW, EXP, LOG, LN, GAMMA, etc.), trigonometic, and hyperbolic functions need only five extra digits, but ten
<br>and then only displaydisplaying the number of digits that is desired, or the number(s) could be re-normalized with the FORMAT bif.
│ could be re-normalized using the FORMAT bif. │
│ │
│ The technique used (below) is to set the numeric digits ten higher │
│ than the desired digits, as specified by the SHOWDIGS variable. │
└──────────────────────────────────────────────────────────────────────────┘</lang>
<br><br>Most math (POW, EXP, LOG, LN, GAMMA, etc.), trigonometic, 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