Talk:Trigonometric functions: Difference between revisions

m (minor optimization x2=x**2)
Line 93:
I don't think people want to understand the huge driver and its details (SHOWDIGS)
but rather want to use the functions offered for their task.
 
---
 
: The huge driver is mainly two statements with eight more to invoke the functions
:
<lang rexx>showdigs=30 /*show only 30 digits of number. */
numeric digits showdigs+10</lang>
In my other "trig/hyperbolic/math" subroutine (not included here), I have 175 different functions, and
<br>adding the REXX statements to bump the precision and re-nonormalize the result for each of the those
<br>functions would be to burdensome. In most likehood, the re-normaliztion would be a waste of time if
<br>the invocation program is performing a series of SIN calls, as indeed, the Rosetta Code example does.
<br>The small program (here on Rosetta Code) only has 18 internal functions, and even that small number
<br>would add a lot of code.
<br>This type of REXX code (bumping the precision, re-normalizing) can't be consoliated because of the
<br>manner in which REXX honors '''numeric digits''' between subroutine calls, so it's impossible to use a REXX
<br>subroutine to avoid the repetitious code. Making 175 unique subroutines is one way of solving that problem,
<br>but that's only a small fraction (well, ok, 1.2%) of the the total number of functions that my (written
<br>elsewhere) trig/hyperbolic/math package has, but clearly, one can see the problem with adding that large a
<br>number of external functions.
<br>There is another problem with function name collision, which is another topic for another time.
<br>So instead, I did what was suggested in the (prologue) commentary, that is: to increase the precision
<br>higher than you need, and just use what precision you need from that time on. I added whitespace
<br>around that part of the comments so you can more easily see what I said. If you want to use the SIN
<br>SIN function and ignore the prologue (as far as intent), then you'll get what you programmed for.
<br>This is basic REXX programming.
<br>Your own code acknowledges that you need more precision than what you want, so the proglogue for the
<br>REXX example does that with the '''showdigs''' variable, as the section and REXX code comments clearly
<br>state. -- [[User:Gerard Schildberger|Gerard Schildberger]] 21:23, 23 June 2012 (UTC)
<br><br>
 
I did not modify anything!
Just took sin (and the routines used by it) out of the rosetta-box
and used it in my program as follows:
Numeric Digits 30
Say sin(0.1)