fpu/e_expl.c for i686
Stephen L Moshier
moshier@mediaone.net
Mon May 7 12:24:00 GMT 2001
> +__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
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?
More information about the Libc-alpha
mailing list