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
- From: dominiq at lps dot ens dot fr (Dominique Dhumieres)
- To: gcc at gcc dot gnu dot org
- Cc: vincent+gcc at vinc17 dot org, matz at suse dot de, konstantin dot vladimirov at gmail dot com
- Date: Fri, 03 Feb 2012 17:40:05 +0100
- Subject: Re: weird optimization in sin+cos, x86 backend
While I fail to see how the "correct value" of
cos(4.47460300787e+182)+sin(4.47460300787e+182)
can be defined in the 'double' world, cos^2(x)+sin^2(x)=1 and
sin(2*x)=2*sin(x)*cos(x) seems to be verified (at least for this value)
even if the actual values of sin and cos depends on the optimisation level.
Note that sqrt(2.0)*sin(4.47460300787e+182+pi/4) gives a diffeent value
for the sum.
Cheers,
Dominique