From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18115 invoked by alias); 26 May 2005 16:05:36 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 18009 invoked by uid 22791); 26 May 2005 16:05:08 -0000 Received: from smtpout01-04.mesa1.secureserver.net (HELO smtpout01-04.mesa1.secureserver.net) (64.202.165.79) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Thu, 26 May 2005 16:05:08 +0000 Received: (qmail 9196 invoked from network); 26 May 2005 16:05:07 -0000 Received: from unknown (24.96.113.81) by smtpout01-04.mesa1.secureserver.net (64.202.165.79) with ESMTP; 26 May 2005 16:05:06 -0000 Message-ID: <4295F374.6070901@coyotegulch.com> Date: Thu, 26 May 2005 17:24:00 -0000 From: Scott Robert Ladd User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050512) MIME-Version: 1.0 To: Richard Henderson , gcc@gcc.gnu.org Subject: Re: Sine and Cosine Accuracy References: <4295DE66.2050701@coyotegulch.com> <20050526154754.GA10785@redhat.com> In-Reply-To: <20050526154754.GA10785@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-05/txt/msg01427.txt.bz2 Richard Henderson wrote: > On Thu, May 26, 2005 at 10:34:14AM -0400, Scott Robert Ladd wrote: > >> static const double range = PI; // * 2.0; >> static const double incr = PI / 100.0; > > > The trig insns fail with large numbers; an argument > reduction loop is required with their use. Yes, but within the defined mathematical ranges for sine and cosine -- [0, 2 * PI) -- the processor intrinsics are quite accurate. Now, I can see a problem in signal processing or similar applications, where you're working with continuous values over a large range, but it seems to me that a simple application of fmod (via FPREM) solves that problem nicely. I've never quite understood the necessity for performing trig operations on excessively large values, but perhaps my problem domain hasn't included such applications. ..Scott