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

Bruce Evans brde at optusnet.com.au
Sat Dec 5 04:41:54 UTC 2015


On Fri, 4 Dec 2015, NGie Cooper wrote:

>> 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.

C99 requires it, but FreeBSD doesn't support it.  Compilers still don't
support delicate floating point things for C90, so I don't feel too bad
about this.

>> 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);

That is just the types.  The following misimplementation also has the
correct types: '#define powl(x, y) 1.0L'.  This is actually more precise
than than the current one on average (it gets almost all cases completely
wrong, but the current one gets more than 99% of cases wrong and has more
errors of infinity instead of large and finite).  It is only worse on
average for non-exceptional cases like powl(2, 2).

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

The details are large and not very interesting.  A polite version of what
I think of this might be "The the powl() function is not of production
quality.  It is similar to '#define powl(x, y) (pow((x), (y)))'".

Bruce


More information about the svn-src-all mailing list