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: [RFC] Speedup trig. functions with large inputs.


On Tue, 30 Apr 2013, OndÅ~Yej Bílka wrote:

> So we compute table containing (2**i) mod pi for these i and suming them
> together gives number that is at most 55*pi large. I could do this in
> integers with 64bit precision.

It's not clear why adding one number for each mantissa bit should be 
faster than multiplication using appropriate bits of a precomputed value 
of 2/pi (so dealing with many bits at once), which is essentially what 
k_rem_pio2.c does.  (OK, k_rem_pio2.c isn't actually what's used by the 
dbl-64 implementations of trigonometrical functions, though it gets used 
for long double.  But the idea of branred.c seems to be similar even if 
the code is more obscure and uncommented.)

In any case, the case of huge arguments to these functions is not the 
common case for which performance optimization is important (although you 
probably do want to be fast for arguments on the order of 10pi, say).

-- 
Joseph S. Myers
joseph@codesourcery.com

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