[BUG][GCC] *Serious* optimization bug: Any gcc specialists outthere?

Arjen van Elteren ak.elteren at quicknet.nl
Sat Aug 5 11:52:05 UTC 2000


On Sat, 5 Aug 2000, Stephan Rudlof wrote:

> Arjen van Elteren wrote:
> > 
> > Hi stephan,
> > 
> > I've got the same problem (also the same version)
> > but could solve it adding
> > #define __NO_MATH_INLINES
> > before
> > #include <math.h>
> > 
> > Seems to work ok after this...
> 
> Works for me, too; but with correct or incorrect result
> 	sin(arg1): -7.469219e-01
> .
> If the result *would* be correct, this *could* be a workaround; but I think
> the bug *should* be fixed in the inline implementation.
> 
> Too many *ould's for my taste here ;-(
> 

I think that what we are looking at here is no real gcc or even math 
library fault. It is probably an overflow/round-off problem 
(how much accurancy do you need to calculate sin( 1e20 )
 correctly ?). If you really are interested in the
correct answer I think you should use a infinite precision library.
Or you can play around with IEEE settings. See also the gnu scientific library;
http://sources.redhat.com/gsl/

As has been noted before the actual CPU might have the deciding call
on the calculation of sin(1e20). 

I can live with a different answer as long as it is correct and faster
for real cases ( [-1eX , -1e-Y] and [1eY,1eX] ) ( X and Y to be determined but always smaller then 20 )

Arjen





More information about the Squeak-dev mailing list