From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 530 invoked by alias); 30 May 2005 23:15:39 -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 517 invoked by uid 22791); 30 May 2005 23:15:36 -0000 Received: from outmail1.freedom2surf.net (HELO outmail.freedom2surf.net) (194.106.33.237) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 30 May 2005 23:15:36 +0000 Received: from [192.168.8.100] (i-195-137-95-70.freedom2surf.net [195.137.95.70]) by outmail.freedom2surf.net (8.12.10/8.12.10) with ESMTP id j4UNFVch021326; Tue, 31 May 2005 00:15:31 +0100 Message-ID: <429B9E92.50507@cs.york.ac.uk> Date: Tue, 31 May 2005 03:10:00 -0000 From: chris jefferson User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) MIME-Version: 1.0 To: Scott Robert Ladd CC: espie@nerim.net, Georg Bauhaus , Marc Espie , gcc@gcc.gnu.org Subject: Re: Sine and Cosine Accuracy References: <4295DE66.2050701@coyotegulch.com> <20050526154754.GA10785@redhat.com> <4295F374.6070901@coyotegulch.com> <17045.62613.557950.285394@gargle.gargle.HOWL> <20050529155740.D440412D1A@quatramaran.ens.fr> <429A10F4.3040704@futureapps.de> <20050529192354.GA21142@lain.home> <429B369F.3040507@coyotegulch.com> In-Reply-To: <429B369F.3040507@coyotegulch.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-05/txt/msg01661.txt.bz2 Scott Robert Ladd wrote: >Marc Espie wrote: > > >>Heck, I can plot trajectories on a sphere that do not follow great circles, >>and that extend over 360 degrees in longitude. I don't see why I should be >>restricted from doing that. >> >> > >Can you show me a circumstance where sin(x - 2 * pi) and sin(x + 2 * pi) >are not equal to sin(x)? > >Using an earlier example in these threads, do you deny that >sin(pow(2.0,90.0)) == sin(5.15314063427653548) == >sin(-1.130044672903051) -- assuming no use of >-funsafe-math-optimizations, of course? > > > I would like to say yes, I disagree that this should be true. By your argument, why isn't sin(pow(2.0,90.0)+1) == sin(6.153104..)? Also, how the heck do you intend to actually calculate that value? You can't just keep subtracting multiples of 2*pi from pow(2.0, 90.0) else nothing will happen, and if you choose to subtract some large multiple of 2*pi, your answer wouldn't end up accurate to anywhere near that many decimal places. Floating point numbers approximate real numbers, and at the size you are considering, the approximation contains values for which sin(x) takes all values in the range [-1,1]. Chris