This is the mail archive of the libc-alpha@sources.redhat.com 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]

Re: fpu/e_expl.c for i686


Stephen L Moshier <moshier@mediaone.net> writes:

> > +__ieee754_expl (long double x)
> > ...
> > +       "fldl2e\n"
> > +       "fmulp\n"			/* x * log2(e) */
> > +       "fld				%%st\n"
> > +       "frndint\n"					/* int(x *> log2(e)) */
> > +       "fsubr	%%st,%%st(1)\n"		/* fract(x * log2(e)) */
> 
> This code seems adequate for double precision but it has poor
> accuracy for long double, due to error amplification over the
> wider domain of the long double function.  For example, expl(1000)
> is off by roughly 460 ulps.  I would suggest improving the range reduction

expl (1000) is .19e435 and can only be represented with long doubles.
How much would the error be for expl (100)?

> method here, but since that entails three or four more multiplications
> you might not want to make the speed sacrifice.  What would your
> policy be about this tradeoff of speed versus accuracy?

I personally would go for accuracy.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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