This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc handling of the sin, cos functions


In a message dated 11/18/99 7:34:52 PM Pacific Standard Time, 
jcarrig@bellatlantic.net writes:

> gcc C compiler (math library) for Intel platforms
>  does not take advantage of the floating point unit in calculating sin, 
cos, 
> exp
>  etc.  Is this correct?  If not, how can I get the compiler to do it?
As others have pointed out, this depends on which library you are using.  
glibc does not provide a way to avoid using the 387 built-ins, as you are 
using either mathinline.h or the 387 coded library functions, according to 
the options and defines you supply.  newlib avoids using 387 code, as you 
say.  Strangely, the greatest accuracy problems with newlib are in the expf() 
and asinf(), which you will not be using unless you invoke them explicitly.

Both of the glibc methods take shortcuts in the calculation of exp() and 
pow(), and miscues in the calculation of asin(), so that you do not 
necessarily get accurate double results in the functions which depend on 
these.  The versions of glibc mathinline.h prior to 2.1.3 also carry bugs 
which can lead to float stack overflow errors.

If you would like to add long double 387 functions or mathinline, I have 
provided a set, along with an elefunt test suite, at 
ftp://members.aol.com/n8tm/llibm.tgz

Tim
tprince@computer.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]