This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/5] Use fabs(x) instead of branching on signedness of input to sin and cos


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]