This is the mail archive of the
mailing list for the GCC project.
Re: weird optimization in sin+cos, x86 backend
On 2012-02-03 10:33:58 -0500, Robert Dewar wrote:
> On 2/3/2012 10:28 AM, Vincent Lefevre wrote:
> >If the user requested such a computation, there should at least be
> >some intent. Unless an option like -ffast-math is given, the result
> >should be accurate.
> What is the basis for that claim? to me it seems useless to expect
> anything from such absurd arguments. Can you site a requirement to
> the contrary (other than your (to me) unrealistic expectations).
> In particular, such large numbers are of course represented
Actually you don't know. Of course, the value probably comes from
somewhere, where it is imprecise. But there are codes that assume
that their input values should be regarded as exact or they will
no longer work. Reasons can be that algorithms are designed in such
a way and/or that consistency is important. A particular field is
computational geometry. For instance, you have a point and a line
given by their coordinates, which are in general imprecise.
Nevertheless, one generally wants to consider that the point is
always seen as being on one fixed side of the line (or exactly on
the line). If some parts of the program, because they do not compute
with high precision enough, behave as if the point were on some side
and other parts behave as if the point were on the other side, this
can yield important problems.
Another property that one may want is "correct rounding", mainly
for reproducibility. For instance, this was needed by the LHC@home
project of CERN (to check results performed on different machines,
IIRC), even though the results were complete chaos.
Vincent Lefèvre <firstname.lastname@example.org> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)