From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23514 invoked by alias); 14 Feb 2003 03:56:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 23500 invoked by uid 71); 14 Feb 2003 03:56:01 -0000 Date: Fri, 14 Feb 2003 03:56:00 -0000 Message-ID: <20030214035601.23499.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Richard Addison-Wood Subject: Re: optimization/9654: extra-precision fp comparisons are less accurate Reply-To: Richard Addison-Wood X-SW-Source: 2003-02/txt/msg00604.txt.bz2 List-Id: The following reply was made to PR optimization/9654; it has been noted by GNATS. From: Richard Addison-Wood To: rearnsha@gcc.gnu.org Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org Subject: Re: optimization/9654: extra-precision fp comparisons are less accurate Date: Fri, 14 Feb 2003 16:48:38 +1300 It's quite reasonable to assume that acos(1-0.5*DBL_EPSILON) will not be 0. For a value of d that is nearly 1: acos(d) == sqrt(1-d*d) is a good approximation (certainly within representational limits ieee754 double precision). The point to notice here is that if d is distinguishable from 1, d*d will be even more distinguishable from 1. All told, it very reasonable to expect: acos(1-0.5*DBL_EPSILON) == sqrt(DBL_EPSILON) which is a value that is not particularly close to 0. However, it is still close enough to 0 so that: sin(sqrt(DBL_EPSILON)) == sqrt(DBL_EPSILON) is a good approximation. Of course, this discourse into acos(), sin(), and sqrt() is beside the point. With code like this: if (d < 1.0) { arglessthanone(d); } it should be the case that the arglessthanone() function should not see an argument value that is greater than or equal to 1.0.