From: Joseph Myers <joseph@codesourcery.com>
To: Manfred <mx2927@gmail.com>
Cc: <libc-alpha@sourceware.org>
Subject: Re: [PATCH 2/5] Use fabs(x) instead of branching on signedness of input to sin and cos
Date: Tue, 23 Aug 2016 23:05:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.20.1608232304190.1642@digraph.polyomino.org.uk> (raw)
In-Reply-To: <3182d325-2608-d6cf-2e1c-c13a7d44d4a0@gmail.com>
On Tue, 23 Aug 2016, 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.
That should be __copysign for namespace reasons (though they should
generally do the same thing because of inlines in math_private.h).
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2016-08-23 23:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-23 18:23 [PATCH 0/5] sin/cos/sincos cleanups Siddhesh Poyarekar
2016-08-23 18:23 ` [PATCH 5/5] Inline all support functions for sin and cos Siddhesh Poyarekar
2016-08-30 3:12 ` [PING][PATCH " Siddhesh Poyarekar
2016-08-30 7:53 ` [PATCH " Andreas Schwab
2016-08-30 7:59 ` Ramana Radhakrishnan
2016-08-30 8:48 ` Siddhesh Poyarekar
2016-09-01 16:36 ` Joseph Myers
2016-08-23 18:23 ` [PATCH 2/5] Use fabs(x) instead of branching on signedness of input to " Siddhesh Poyarekar
2016-08-23 20:53 ` Manfred
2016-08-23 23:05 ` Joseph Myers [this message]
2016-08-24 2:50 ` Siddhesh Poyarekar
2016-08-29 16:19 ` Joseph Myers
2016-08-23 18:23 ` [PATCH 4/5] Use DO_SIN for sin(x) where 0.25 < |x| < 0.855469 Siddhesh Poyarekar
2016-08-30 3:12 ` [PING][PATCH " Siddhesh Poyarekar
2016-09-01 16:35 ` [PATCH " Joseph Myers
2016-08-23 18:23 ` [PATCH 1/5] Consolidate reduce_and_compute code Siddhesh Poyarekar
2016-08-24 1:52 ` Adhemerval Zanella
2016-08-29 16:03 ` Joseph Myers
2016-08-30 9:26 ` Siddhesh Poyarekar
2016-08-23 18:23 ` [PATCH 3/5] Consolidate input partitioning into do_cos and do_sin Siddhesh Poyarekar
2016-08-30 3:12 ` [PING][PATCH " Siddhesh Poyarekar
2016-09-01 16:23 ` [PATCH " Joseph Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1608232304190.1642@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=mx2927@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).