(SC22WG11.419) pi and LIA
uunet!cwi.nl!Dik.Winter
uunet!cwi.nl!Dik.Winter
Tue Jan 17 15:11:55 PST 1995
One comment about this:
> 1. Trig functions with preselected bases other than "radians".
> David says:
...
> > The "trigd" functions are a common Fortran extension, and the trigpi
> > functions less so, although they have been provided in Sun's libraries
> > for C and Fortran since 1988. They are just the TRIGFF functions
> > prescribed in LIA-2, with u fixed at 360 and 2 respectively;
...
> I agree with the latter part of this. The two base-specific functions can
> be coded with more efficiency, more reliability, and, in the case of
> <trig>pi(x) higher guaranteed accuracy. That makes these functions more
> desirable than TRIGFF and suggests that they be recommended for use OVER
> TRIGFF where appropriate!
I disagree. In Ada TRIGFF has been standardized. Coding is barely more
work than a single argument function. What you do is an exact reduction
of the first argument mod the second argument (which can be done using
IEEE arithmetic). [Perhaps you wish to reduce to one half or one quarter
of this range; that does not matter.] Once you have done that you can
nearly reduce to the single argument case. If for instance your base
approximation for sin(x) uses a polynomial approximation for (sin(x)-x)/x
you easily find a good approximation for the sin with arbitrary second
argument. One caveat: you should never code sin(x) through sin(x,pi*2).
I think Peter Tang has done some coding in this area (as I did).
dik
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924098
home: bovenover 215, 1025 jn amsterdam, nederland; e-mail: dikacwi.nl
More information about the Numeric-interest
mailing list