This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 08/10] Add new log implementation
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- Cc: <libc-alpha at sourceware dot org>, <nd at arm dot com>
- Date: Fri, 24 Aug 2018 17:19:18 +0000
- Subject: Re: [PATCH 08/10] Add new log implementation
- References: <d4963b4e-0013-adaf-df2f-698cf421a487@arm.com> <66ab169b-df54-4d96-0a18-ed27f53e0912@arm.com>
On Fri, 6 Jul 2018, Szabolcs Nagy wrote:
> Optimized log using carefully generated lookup table with 1/c and log(c)
> values for small intervalls around 1. The log(c) is very near a double
> precision value, it has about 62 bits precision. The algorithm is
> +extern const struct log_data
> +{
> + double ln2hi;
> + double ln2lo;
> + double poly[LOG_POLY_ORDER - 1]; /* First coefficient is 1. */
> + double poly1[LOG_POLY1_ORDER - 1];
> + struct {double invc, logc;} tab[1 << LOG_TABLE_BITS];
> +#ifndef __FP_FAST_FMA
> + struct {double chi, clo;} tab2[1 << LOG_TABLE_BITS];
> +#endif
> +} __log_data attribute_hidden;
There should be comments explaining all these values.
In the case of c, the comments should give sufficient information for
someone to regenerate the tables, or even better, include source code for
a generator. You've given an outline of the intent above (which belongs
in the comments, not just in the commit message), but a more precise
specification is needed to be able to reproduce these tables - this isn't
simply a matter of approximating function X on interval Y, or of values of
2^(k/N) at particular points that are adequately specified by a brief
comment in the exp/exp2 patch, there's some more complicated logic
involved here that needs to be specified, of what you're optimizing over
what set of possible values of c (or invc or logc) that results in these
tables.
--
Joseph S. Myers
joseph@codesourcery.com