svn commit: r290605 - in head/lib/msun: . man

Warner Losh imp at bsdimp.com
Sat Dec 5 05:20:09 UTC 2015


On Fri, Dec 4, 2015 at 7:34 PM, NGie Cooper <yaneurabeya at gmail.com> wrote:

> Hi Bruce!
>
> > On Nov 9, 2015, at 04:03, Bruce Evans <brde at optusnet.com.au> wrote:
> >
> > On Mon, 9 Nov 2015, Garrett Cooper wrote:
> >
> >> Log:
> >> Document powl(3)
> >
> > powl was garbage that was intentionally undocumented.  At least, I
> > intentionally ignored its non-documentation together with it.
>
> POSIX documents it and I noticed it was missing when porting the msun
> testcases from NetBSD. That’s the reason why I filed the bug.
>
> > powl doesn't compute the value of .Ar x to the exponent .Ar y.  It
> computes
> > the value of (double)(.Ar x) to the exponent (double)(.Ar y), converted
> to
> > double.
>
> Hmmm? The types look ok per the function signatures in lib/msun:
>
> lib/msun/src/imprecise.c:imprecise_powl(long double x, long double y)
> lib/msun/src/math.h:long double     powl(long double, long double);
>

The prototype is right. The code is poo. It does as Bruce says. That's why
it wasn't documented. People might think it was safe to use.

>
> These are bugs that need to be fixed then in the longterm, but in the
> short term should be documented under CAVEATS.
>

It is so aweful, it should have remained undocumented until a
suitable implementation showed up.



> > I doubt that the rest of this section (about exception handling) is
> > correct for powl().
> >
> > The section on errors wasn't changed since it uses generic pow().  It
> > claims that the error is generally less than 1 ulp.  But for powl(),
> > the error is generally more that 4096 ulps.  Much more when the
> > error exponentiates.  powf() and pow() do well to avoid exponentiation
> > of roundoff errors.
>
> I think the comment above applies here too about adding some notes to
> CAVEATS.
>


This is what makes it poo. 4096 ulps is really horrific.

Warner


More information about the svn-src-head mailing list