Trigonometric functions: Difference between revisions
Content added Content deleted
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: | 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 |
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. |
<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 │ |
|||
⚫ | |||
│ more precision (via NUMERIC DIGITS nnn) than is needed, and │ |
|||
⚫ | |||
⚫ | |||
│ 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>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>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 |
<br>It should also be noted that both the '''pi''' and '''e''' constants have only around 77 decimal digits as included here, if more |