This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Speedup trig. functions with large inputs.
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: <libc-alpha at sourceware dot org>
- Date: Mon, 29 Apr 2013 23:05:08 +0000
- Subject: Re: [RFC] Speedup trig. functions with large inputs.
- References: <20130429220547 dot GA30533 at domone dot kolej dot mff dot cuni dot cz>
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