Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Dec 2015 22:20:07 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        NGie Cooper <yaneurabeya@gmail.com>
Cc:        Bruce Evans <brde@optusnet.com.au>, Garrett Cooper <ngie@freebsd.org>,  src-committers <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r290605 - in head/lib/msun: . man
Message-ID:  <CANCZdfqJa2iEdFSJ0ryVj6Rn5cYwXZOCVJzc%2BVKajNAduAXieQ@mail.gmail.com>
In-Reply-To: <4E9A0C74-DC06-41E3-A27D-46FF06A98C95@gmail.com>
References:  <201511091040.tA9AeG0B038056@repo.freebsd.org> <20151109223117.Y2340@besplex.bde.org> <4E9A0C74-DC06-41E3-A27D-46FF06A98C95@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 4, 2015 at 7:34 PM, NGie Cooper <yaneurabeya@gmail.com> wrote:

> Hi Bruce!
>
> > On Nov 9, 2015, at 04:03, Bruce Evans <brde@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=E2=80=99s 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqJa2iEdFSJ0ryVj6Rn5cYwXZOCVJzc%2BVKajNAduAXieQ>