From patchwork Tue Sep 27 17:49:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 16081 Received: (qmail 113064 invoked by alias); 27 Sep 2016 17:49:38 -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 112954 invoked by uid 89); 27 Sep 2016 17:49:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL autolearn=no version=3.3.2 spammy=1025 X-HELO: homiemail-a51.g.dreamhost.com From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Subject: [PATCH 2/4] Check n instead of k1 to decide on sign of sin/cos result Date: Tue, 27 Sep 2016 23:19:11 +0530 Message-Id: <1474998553-2366-3-git-send-email-siddhesh@sourceware.org> In-Reply-To: <1474998553-2366-1-git-send-email-siddhesh@sourceware.org> References: <1474998553-2366-1-git-send-email-siddhesh@sourceware.org> For k1 in 1 and 3, n can only have values of 0 and 2, so checking k1 & 2 is equivalent to checking n & 2. We prefer the latter so that we don't use k1 for anything other than selecting the quadrant in do_sincos_1, thus dropping it completely. * sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Check N instead of K1. --- sysdeps/ieee754/dbl-64/s_sin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c index d60feb4..ea41a7c 100644 --- a/sysdeps/ieee754/dbl-64/s_sin.c +++ b/sysdeps/ieee754/dbl-64/s_sin.c @@ -353,7 +353,7 @@ do_sincos_1 (double a, double da, double x, int4 n, int4 k) case 3: res = do_cos (a, da, &cor); cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps; - retval = ((res == res + cor) ? ((k1 & 2) ? -res : res) + retval = ((res == res + cor) ? ((n & 2) ? -res : res) : sloww2 (a, da, x, n)); break; }