From: Dave Dodson Newsgroups: sci.math.num-analysis Subject: Re: looking for trig function implementations Date: 30 Oct 1995 11:23:27 -0600 In article <46re4j$t0v@horus.infinet.com>, czarnak wrote: >Greetings, > >I am attempting to implement the trigonometric functions sin, cos, tan >and atan in a computer language which does not have a built in math >library. Currently I am using Taylor series finite approximations... > >My problem is that the domain for the tan and atan function >approximations varies from -1 to +1 radians, but my application might >have values that exceed +1 radians. > >I therfore am looking for any other options short of a lookup table scheme. > >Any help / pointers would be greatly appreciated. The definitive reference in this area is Cody, Wm J and Wm Waite, Software Manual for the Elementary Functions. Englewood Cliffs, NJ: Prentice-Hall, Inc., 1980. It gives algorithms that do these functions with the best possible accuracy and good efficiency. ---------------------------------------------------------------------- Dave Dodson dodson@convex.com Convex Computer Corporation Richardson, Texas (214) 497-4234 ============================================================================== From: Ray Andraka Newsgroups: sci.math,comp.arch.arithmetic,comp.graphics.algorithms,comp.infosystems.www.authoring.cgi Subject: Re: Problem: Calcing log from simple math Date: 18 Nov 1995 00:34:44 GMT jdeutsch@csn.net (Jesse Deutsch) wrote: > > What are the polynomial and CORDIC algorithms? Power series > expansion for log has anemic convergence strength. > See my earlier post. The class of algorithms taking the form: X[i+1] = X[i] +/- Y[i]*d[i]*2^(-i) are refered to as the CORDIC algortihms. Many of the algorithms use several of these "rotation elements". In these d[i] is a decision function generally taking on values of 1 or 0 or +/-1. This way the multiplication is performed with gating or an adder subtractor stage (depending on the specific algorithm). Note that the equation uses only shifts and adds. The Log algorithm uses two of these "rotation elements" as follows: F[i+1] = F[i] + F[i]*d[i]*2^(-i) and X[i+1] = X[i] + Log(1+2^(-i))*d[i] in this case d[i]=1 for F[i+1], randraka@ids.net says... > >jdeutsch@csn.net (Jesse Deutsch) wrote: >> >> What are the polynomial and CORDIC algorithms? Power series >> expansion for log has anemic convergence strength. >> For the polynomial algorithms, see: Coty, William J., Jr., and Waite, William, SOFTWARE MANUAL FOR THE ELEMENTARY FUNCTIONS, Prentice-Hall Series in Computational Mathematics, Prentice-Hall, Inc., Inglewood Cliffs, NJ, 1980, pp. 35-59. For an excellent implementation of the polynomial approximation, see the Cephes code for log.c or logl.c, available via anonymous ftp from netlib.att.com. These algorithms assume that you can extract the exponent from the original number. That operation was not among those listed by the original poster, though likely derivable from them with some effort. -- The opinions expressed in this message are my own personal views and do not reflect the official views of Microsoft Corporation.