Date: Sun, 22 Dec 1996 09:57:29 +0200 (IST) From: Eli Zaretskii To: djgpp AT delorie DOT com Subject: Re: Is DJGPP that efficient? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 20 Dec 1996, Francois Charton wrote: > for x between 0 and PI/2, cos(x) can be approximated by > > x2=x*x; > co=1.0+x2*(x2*0.03705 - 0.4967); > > with over three decimal place precision > > and by > x2=x*x; > co=1.0+x2*(-0.4999999963 + x2*(0.0416666418 + x2*(-0.0013888397 + > x2*(0.0000247609 - x2*0.0000002605)))); > > with over 8 decimal places (this one is actually the function that most > pocket calculators use) If you only need 3 decimal places of accuracy, use a pre-computed table of values. Any serious general-purpose fp code cannot assume that the argument is between 0 and PI/2, and most of the time of the library functions is spent in the so-called argument reduction process (which brings the argument to a narrow region around 0 where a simple approximation can be used).