From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111307 invoked by alias); 24 Aug 2016 02:50:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 110924 invoked by uid 89); 24 Aug 2016 02:50:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=H*M:4ff0, Wednesday X-HELO: homiemail-a52.g.dreamhost.com Subject: Re: [PATCH 2/5] Use fabs(x) instead of branching on signedness of input to sin and cos To: Manfred , libc-alpha@sourceware.org References: <1471976565-3576-1-git-send-email-siddhesh@sourceware.org> <1471976565-3576-3-git-send-email-siddhesh@sourceware.org> <3182d325-2608-d6cf-2e1c-c13a7d44d4a0@gmail.com> From: Siddhesh Poyarekar Message-ID: <7c9ef112-b870-2abc-4ff0-766c00c72dc9@gotplt.org> Date: Wed, 24 Aug 2016 02:50:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <3182d325-2608-d6cf-2e1c-c13a7d44d4a0@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-08/txt/msg00744.txt.bz2 On Wednesday 24 August 2016 02:23 AM, Manfred wrote: > If eps is known to be >=0 then >> + cor = 1.0005 * cor + ((cor > 0) ? eps : -eps); > might be written as > cor = 1.0005 * cor + copysign(eps, cor); > > Similarly to fabs(), copysign() avoids a branch - or a potential one > from the ternary. Thanks, there are a lot of places in the code that can benefit from this, so I'll post a separate patch to clean it all up. Siddhesh