|Sine and Cosine Accuracy on AMD64 and Pentium 4 email@example.com (Scott Robert Ladd) (2005-05-26)|
|Re: Sine and Cosine Accuracy on AMD64 and Pentium 4 firstname.lastname@example.org (glen herrmannsfeldt) (2005-05-28)|
|Re: Sine and Cosine Accuracy on AMD64 and Pentium 4 email@example.com (Jack Crenshaw) (2005-07-17)|
|Re: Sine and Cosine Accuracy on AMD64 and Pentium 4 Juergen.Kahrs@vr-web.de (=?ISO-8859-1?Q?J=FCrgen_Kahrs?=) (2005-07-17)|
|Re: Sine and Cosine Accuracy on AMD64 and Pentium 4 firstname.lastname@example.org (glen herrmannsfeldt) (2005-07-22)|
|Re: Sine and Cosine Accuracy on AMD64 and Pentium 4 email@example.com (2005-07-26)|
|From:||glen herrmannsfeldt <firstname.lastname@example.org>|
|Date:||22 Jul 2005 20:16:38 -0400|
|Posted-Date:||22 Jul 2005 20:16:38 EDT|
Jack Crenshaw wrote:
> 1) are you sure your value of pi is not part of the problem?
> I have always been told to let the numeric processor set
> its own value, which it knows internally at 80-bit accuracy.
> You can get that value using something like
> pi = 4 * atan(1);
There was recently a long discussion in comp.lang.fortran about
argument reduction for trigonometric functions.
In this case, however, it doesn't depend much at all
on the value of pi.
> 2) It seems to me you're testing the output of the log function > as
much as anything else. Why the logarithmic approach?
The log converts to bits or digits. That also shouldn't have
much effect on the result.
(big snip of complicated program, the most important
>> double s1 = sin(x);
>> double c1 = cos(x);
>> double one = s1 * s1 + c1 * c1;
>> double diff = one - 1.0;
>> final *= one;
For a variety of different values of x.
Note that this does not depend at all on the accuracy of the sin
and cos functions. If sin() returned 1 for all x, and cos() returned
zero you would call it perfectly accurate where it obviously isn't.
There are algorithms where maintaining identities is more important
than accuracy, some of which go by the name symplectic.
A dynamics problem, for example, may find that conservation of energy
is more important than the accurate final positions of the objects.
If one is trying to land an object on mars, the final position is more
important than the accurate kinetic energy.
Return to the
Search the comp.compilers archives again.