28 May 2005 14:00:25 -0400

Related articles |
---|

Sine and Cosine Accuracy on AMD64 and Pentium 4 scott.ladd@coyotegulch.com (Scott Robert Ladd) (2005-05-26) |

Re: Sine and Cosine Accuracy on AMD64 and Pentium 4 gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-05-28) |

Re: Sine and Cosine Accuracy on AMD64 and Pentium 4 jcrens@earthlink.net (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 gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-07-22) |

Re: Sine and Cosine Accuracy on AMD64 and Pentium 4 henry@spsystems.net (2005-07-26) |

From: | glen herrmannsfeldt <gah@ugcs.caltech.edu> |

Newsgroups: | comp.compilers |

Date: | 28 May 2005 14:00:25 -0400 |

Organization: | Compilers Central |

References: | 05-05-215 |

Keywords: | arithmetic |

Posted-Date: | 28 May 2005 14:00:25 EDT |

Scott Robert Ladd wrote:

*> Let's consider the accuracy of sine and cosine. I've run tests as*

*> follows, using a program provided at the end of this message.*

(snip)

*> for (x = -range; x <= range; x += incr)*

*> {*

*> double s1 = sin(x);*

*> double c1 = cos(x);*

*> double one = s1 * s1 + c1 * c1;*

*> double diff = one - 1.0;*

*> final *= one;*

*>*

*> double accuracy1 = binary_accuracy(diff);*

(snip)

I find this a very strange test for the accuracy of sin() and cos().

I suppose any that fail it are obviously bad, but a good result

doesn't give me much confidence in the functions.

A sin() that always returns 1 and cos() that always returns zero will

get a perfect score. As you are getting results better than the 53

bits for a double seems especially suspect.

-- glen

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.