Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Oct 2012 07:38:28 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Warner Losh <imp@FreeBSD.org>
Subject:   Re: svn commit: r241755 - head/lib/msun/src
Message-ID:  <80A9038D-C84B-47D3-A137-F281449F4D88@bsdimp.com>
In-Reply-To: <20121022213348.T1373@besplex.bde.org>
References:  <201210192246.q9JMkm4R092929@svn.freebsd.org> <20121020150917.I1095@besplex.bde.org> <18177777-6EE0-4103-98B0-272EFF98FE96@bsdimp.com> <20121022213348.T1373@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Oct 22, 2012, at 5:14 AM, Bruce Evans wrote:

> On Sun, 21 Oct 2012, Warner Losh wrote:
>=20
>> Feel free to fix them however.  I added the comments because the =
algorithms weren't quite the same...  If you have a better way, feel =
free to back my stuff out on the way to it.
>=20
> But the algorithms are identical to a fault.  Inside the functions, =
all
> lines except 1 in each correspond exactly, and the exception is a =
style
> bug.  Only about 30 lines in each are not lexically identical.  The
> non-lexical differences are for things like different magic numbers.

Except that's not true.  For expf, only the first two terms of the 5 are =
computed in Remes expansion.  That's why I bothered to document the =
difference.  For logf, there are at least two additional terms in the =
intermediate form.

The differences here are:
/* logf */
        t1=3D w*(Lg2+w*Lg4);=20
        t2=3D z*(Lg1+w*Lg3);=20
/* log */
        t1=3D w*(Lg2+w*(Lg4+w*Lg6));
        t2=3D z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7)));
=20
which to even the most casual observer are clearly different.

> The old fdlibm comments aren't too careful about keeping magic numbers
> out of the algorithm description so that the algorithm description is
> as general as possible.  The precise magic numbers are often critical
> to the details of the implementation of the algorithm but not really
> to the algorithm itself.

The current code isn't careful at all about magic numbers.  Which ones =
are magic hex constants for IEEE stuff, and which ones are hex numbers =
for the exact representation of important constants?

Anyway, it is clear you guys don't want them in there so I've reverted =
them.  I'm totally baffled by this request because these algorithms are =
similar not identical, but since you guys are the active maintainers, =
I'll accede to your wishes after expressing my utter bafflement at the =
justifications.

Warner=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?80A9038D-C84B-47D3-A137-F281449F4D88>