From patchwork Tue Aug 23 18:22:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 661997 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sJf2z3zp7z9sRZ for ; Wed, 24 Aug 2016 04:23:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=beXughv7; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Ar6uId9XvUYMU8G0WGPskeTSdRgFK5O uT9Qzlft1JcDcMsurjUyxhV7HPJuouxMNAtahp+WgERTUAic3ZembZVirswITeon vFFKsrYVnIvr2Mb+9j8pz2vIKsYx8eHqmARQXErnVN6NmovvYTxzbxRDn6FdSUyF pMNxUNhZETXM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=vMHwpD6LSU2XA2/C1yEoGxL/q/8=; b=beXug hv76jsoYc/KsYfScsvbkBzgcjx4dW2Qdl9hoeRSopEKoBE/4oL/F76ULLmQlZlNf k36Vgh29FoFhl3Rj1zp8RfOTdskr66QSibDYZV2ndjnKRPoeontnk3CpzdFRADG0 UZTjmjUV3pRJhGUyebtsNEwAE8UhYNYAOdJsY4= Received: (qmail 96871 invoked by alias); 23 Aug 2016 18:23:17 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 96809 invoked by uid 89); 23 Aug 2016 18:23:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.6 required=5.0 tests=BAYES_20, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL autolearn=no version=3.3.2 spammy=favour, ux, 025, fabs X-HELO: homiemail-a59.g.dreamhost.com From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Subject: [PATCH 4/5] Use DO_SIN for sin(x) where 0.25 < |x| < 0.855469 Date: Tue, 23 Aug 2016 23:52:44 +0530 Message-Id: <1471976565-3576-5-git-send-email-siddhesh@sourceware.org> In-Reply-To: <1471976565-3576-1-git-send-email-siddhesh@sourceware.org> References: <1471976565-3576-1-git-send-email-siddhesh@sourceware.org> The only code looks slightly different from DO_SIN but on closer examination, should give exactly the same result. Drop it in favour of the DO_SIN function call. * sysdeps/ieee754/dbl-64/s_sin.c (__sin): Use DO_SIN. --- sysdeps/ieee754/dbl-64/s_sin.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c index e03c75a..82f9345 100644 --- a/sysdeps/ieee754/dbl-64/s_sin.c +++ b/sysdeps/ieee754/dbl-64/s_sin.c @@ -441,7 +441,7 @@ SECTION #endif __sin (double x) { - double xx, res, t, cor, y, s, c, sn, ssn, cs, ccs; + double xx, res, t, cor; mynumber u; int4 k, m; double retval = 0; @@ -471,23 +471,8 @@ __sin (double x) /*---------------------------- 0.25<|x|< 0.855469---------------------- */ else if (k < 0x3feb6000) { - u.x = big + fabs (x); - y = fabs (x) - (u.x - big); - y = (x > 0 ? y : -y); - - xx = y * y; - s = y + y * xx * (sn3 + xx * sn5); - c = xx * (cs2 + xx * (cs4 + xx * cs6)); - SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs); - if (m <= 0) - { - sn = -sn; - ssn = -ssn; - } - cor = (ssn + s * ccs - sn * c) + cs * s; - res = sn + cor; - cor = (sn - res) + cor; - retval = (res == res + 1.096 * cor) ? res : slow1 (x); + res = do_sin (x, 0, &cor); + retval = (res == res + 1.096 * cor) ? (m > 0 ? res : -res) : slow1 (x); } /* else if (k < 0x3feb6000) */ /*----------------------- 0.855469 <|x|<2.426265 ----------------------*/