From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sourceware.org (Postfix) with ESMTPS id AA6E8385840D for ; Mon, 13 Dec 2021 09:53:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AA6E8385840D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=inria.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:message-id:from:to:cc:in-reply-to:subject: references; bh=OmjSK3aOgX4lQX/QAhzNBiFgKaYP4jV1j7Sq7qEpUis=; b=EJkY2Wv+OdZzGB+FN1aMM46UWghCLwVlJm/VIZxkJZGpZ8gTWO3P+ant vSx2DhaziV2dLojaapOrEgEf2GkVZ7AF6A7omkWlikCYoxOkHyrBv/OJf RDvAa6Tia+X7fcfyFaZehY68290Pg2vsqTj4h8Bp5W/eWAKUbqcM57jR8 M=; IronPort-Data: =?us-ascii?q?A9a23=3AUNdkM6nvL0zr1KVdNP509kro5gxIJERdPkR7XQ2?= =?us-ascii?q?eYbTBsI5bpzMHzzAWXWGAbKzfYzOgfIwlYIq+oRwAuseEzd9qSQZo+CA2RRqmi?= =?us-ascii?q?+KVXIXDdh+Y0wC6d5CYEho/t63yUjRxRSwNZie0SiyFb/6x/RGQ6YnSHuClUbS?= =?us-ascii?q?dYXgrLeNZYHxJZSxLyrdRbrFA0YDR7zOl4bsekuWHULOX82Yc3lE8t8pvnChSU?= =?us-ascii?q?MHa41v0iLCRicdj5zcyn1FNZH4WyDrYw3HQGuG4FcbiLwrPIS3Qw4/Xw/stIov?= =?us-ascii?q?NfrfTbkoPS6LfVeSMoiMLAe7y214b/mpvi87XN9JFAatTow2AgtQ3+tRIsJGqT?= =?us-ascii?q?A4vOIXNnv4cWl9WCUmSOIUfoOKacCHv7aR/yGWDKRMA2c5GBUI3OYQH9+J2AWB?= =?us-ascii?q?I+fUwNTsJZ1aOi//e6La6QOIpj8A7LMDDJ4QCoHpt0jjDALAhW5+ra6zJ5NtRw?= =?us-ascii?q?zo0h8BPG/rXT9cSbTMpYRjdCyCjkH9/5IkWgOCtj2XyNTlfslOc46Qti1U/BTd?= =?us-ascii?q?ZiNDFWOc5sPTTLSmNonulmw=3D=3D?= IronPort-HdrOrdr: =?us-ascii?q?A9a23=3AHv6R6Kl7D6XUTZM5g2mFoOMOxgHpDfJL3DAb?= =?us-ascii?q?v31ZSRFFG/Fw8PrOoB1773HJYVkqKRIdcLy7Scu9qBDnmqKdn7NwAV7KZmCP0w?= =?us-ascii?q?GVxepZgbcKrQeMJxHD?= X-IronPort-AV: E=Sophos;i="5.88,202,1635199200"; d="scan'208";a="10559184" Received: from tomate.loria.fr (HELO tomate) ([152.81.10.51]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2021 10:53:39 +0100 Date: Mon, 13 Dec 2021 10:53:38 +0100 Message-Id: From: Paul Zimmermann To: Akila Welihinda Cc: libc-alpha@sourceware.org, akilawelihinda@ucla.edu In-Reply-To: <20211212183503.9332-1-akilawelihinda@ucla.edu> (message from Akila Welihinda on Sun, 12 Dec 2021 10:35:03 -0800) Subject: Re: [PATCH] sysdeps: Simplify sin Taylor Series calculation References: <20211211180214.5692-1-akilawelihinda@ucla.edu> <20211212183503.9332-1-akilawelihinda@ucla.edu> X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Dec 2021 09:53:42 -0000 Dear Akila, thank you for the new version, this seems good to me. Do you have commit access? Best regards, Paul Zimmermann > From: Akila Welihinda > Date: Sun, 12 Dec 2021 10:35:03 -0800 > Cc: Akila Welihinda > > The macro TAYLOR_SIN adds the term `-0.5*da*a^2 + da` in hopes > of regaining some precision as a function of da. However the > comment says we add the term `-0.5*da*a^2 + 0.5*da` which is > different. This fix updates the comment to reflect the > code and also simplifies the calculation by replacing `a` with `x` > because they always have the same value. > > Signed-off-by: Akila Welihinda > --- > sysdeps/ieee754/dbl-64/s_sin.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c > index 7d89e3dfc2..a412c3642d 100644 > --- a/sysdeps/ieee754/dbl-64/s_sin.c > +++ b/sysdeps/ieee754/dbl-64/s_sin.c > @@ -51,16 +51,16 @@ > #define POLYNOMIAL(xx) (POLYNOMIAL2 (xx) + s1) > > /* The computed polynomial is a variation of the Taylor series expansion for > - sin(a): > + sin(x): > > - a - a^3/3! + a^5/5! - a^7/7! + a^9/9! + (1 - a^2) * da / 2 > + x - x^3/3! + x^5/5! - x^7/7! + x^9/9! - dx*x^2/2 + dx > > The constants s1, s2, s3, etc. are pre-computed values of 1/3!, 1/5! and so > on. The result is returned to LHS. */ > -#define TAYLOR_SIN(xx, a, da) \ > +#define TAYLOR_SIN(xx, x, dx) \ > ({ \ > - double t = ((POLYNOMIAL (xx) * (a) - 0.5 * (da)) * (xx) + (da)); \ > - double res = (a) + t; \ > + double t = ((POLYNOMIAL (xx) * (x) - 0.5 * (dx)) * (xx) + (dx)); \ > + double res = (x) + t; \ > res; \ > }) > > -- > 2.30.1 (Apple Git-130) Reviewed-by: Paul Zimmermann