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 08/10] Add new log implementation


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


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