This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: weird optimization in sin+cos, x86 backend
On 2012-02-03 22:57:31 +0000, James Courtier-Dutton wrote:
> On 3 February 2012 16:24, Vincent Lefevre <vincent+gcc@vinc17.org> wrote:
> > But 1.0e22 cannot be handled correctly.
>
> Of course it can't.
> You only have 52 bits of precision in double floating point numbers.
Wrong. 53 bits of precision. And 10^22 is the last power of 10
exactly representable in double precision (FYI, this example has
been chosen because of this property).
In case you don't know, I've participated in the revision of
the IEEE 754 standard, giving the current IEEE 754-2008. And
our team works on computer arithmetic (as my signature says),
mainly floating-point arithmetic. So, I know what I'm talking
about (though I can also make mistakes, as everyone...).
> So, although you can have 1.0e22, you cannot represent (1.0e22 + 1)
[...]
The constant is 1.0e22. Whether you can represent 1.0e22 + 1 or
not doesn't matter.
--
Vincent Lefèvre <vincent@vinc17.net> - 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)