From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 39526 invoked by alias); 17 Oct 2018 22:21:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 39501 invoked by uid 89); 17 Oct 2018 22:21:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1639, H*F:D*br X-HELO: mail-ot1-f52.google.com Received: from mail-ot1-f52.google.com (HELO mail-ot1-f52.google.com) (209.85.210.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Oct 2018 22:21:53 +0000 Received: by mail-ot1-f52.google.com with SMTP id u22so27806945ota.12 for ; Wed, 17 Oct 2018 15:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp-br.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WfAXEdJLBRxPQArquaETQGQYthcA0bzanHxTifIvH80=; b=F+8qpeZAMbcBZb7DtknYx4N6owHRr5kkS+DSIp+ksiViVHL4clKPB3jVjKRCA+7PpU BcBfnH/DQxuCv2iLSOT11yi4J2JeT9CdePeUOcvpjPGxL668uqkvUfJ0/OAnXEcXFnPp ikv052XH8Jtj1CrWW1a55Z8W1Bt3+Ut9Nlpf2SHBk46fUFz51OaQtW+UCnfsmn7L0twG Ap6emO45hcGjL7m+Jt1agkXuRffjRG2WQ6aZdyoSnydWglkeqYAe3EDFXNzmZE7Ny3KA itqVIz+CwdlI/jjRsNFuA0HDV1HtttjygK3B+Oho7I1xHXTEwKHjytVDPJYeJChiG3+r RBDg== MIME-Version: 1.0 References: <1a9f1bf8-cb6a-41e3-e13f-d7743bc16dcb@redhat.com> <6315400f-4ee5-2402-2808-7c6cb04b71d6@redhat.com> <567b3bf1-4858-4d31-e09e-835dfd8427bf@redhat.com> In-Reply-To: <567b3bf1-4858-4d31-e09e-835dfd8427bf@redhat.com> From: Giuliano Augusto Faulin Belinassi Date: Thu, 18 Oct 2018 05:38:00 -0000 Message-ID: Subject: Re: [PATCH] Add sinh(tanh(x)) and cosh(tanh(x)) rules To: Jeff Law Cc: GCC Patches , Paul Koning Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg01070.txt.bz2 Oh, please note that the error that I'm talking about is the comparison with the result obtained before and after the simplification. It is possible that the result obtained after the simplification be more precise when compared to an arbitrary precise value (example, a 30 digits precise approximation). Well, I will try check that. But yes, with regard to compatibility this may be a problem. On Wed, Oct 17, 2018 at 6:42 PM Jeff Law wrote: > > On 10/17/18 3:25 PM, Giuliano Augusto Faulin Belinassi wrote: > >> Hmm, do we have problems as we get close to -1 or 1 where the outputs of > >> the two forms might diverge? > > > > Well, I did some minor testing with that with input x around nextafter(1, -1); > > There are a minor imprecision when comparing directly with > > sinh(atanh(x)) and cosh(atanh(x)). > > * On 32-bits floats, for such x the error is about 10^-4 > > * On 64-bits floats, for such x the error is about 10^-7 > > * On 80-bits floats, for such x the error is about 10^-9 > > > > here are the code that I used for the test: https://pastebin.com/JzYZyigQ > > > > I can create a testcase based on this if needed :-) > My gut instinct is those errors are too significant in practice. > > It also just occurred to me that we may have problems as X approaches X > from either direction. > > Clearly when x^2 is indistinguishable from 0 or 1, then the result has > to be +-0 or +-1. But I'm not sure if figuring out where those points > are is sufficient to avoid the imprecisions noted above. This is *well* > outside my areas of expertise. > > jeff