[BUG][GCC] *Serious* optimization bug: Any gcc specialists
outthere?
Mark van Gulik
ghoul6 at home.net
Sat Aug 5 16:52:49 UTC 2000
> On Sat, 5 Aug 2000, Stephan Rudlof wrote:
...
> 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 ?).
Some of the posters have seen the real problem here, while others have
missed it. Sorry to point out what I thought was obvious, but here goes:
In y=sin(x), for x real, y will always be between -1 and 1. Returning
100000000000000000000.0 is not an acceptable result (by twenty orders of
magnitude!). Even returning 0 would be preferable.
Let's say you're writing a ray tracer and occasionaly have to look at points
on the horizon with a z coordinate of 1/epsilon (say epsilon=1e-20). If
you're computing fluffy clouds or whatever in terms of modulated sinusoids
of different frequencies, you might have to take sin(1e20). This result is
assumed to be between -1 and 1. If you then feed it into, take y arcCos, or
(y+1)sqrt or something, you'll get a domain error, because sin(x) was not
meeting its postcondition (the answer was so far out of bounds it may as
well have answered a *string*).
More information about the Squeak-dev
mailing list
|