svn commit: r241755 - head/lib/msun/src

Warner Losh imp at bsdimp.com
Mon Oct 22 13:38:37 UTC 2012


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

> On Sun, 21 Oct 2012, Warner Losh wrote:
> 
>> 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.
> 
> 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= w*(Lg2+w*Lg4); 
        t2= z*(Lg1+w*Lg3); 
/* log */
        t1= w*(Lg2+w*(Lg4+w*Lg6));
        t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7)));
 
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


More information about the svn-src-head mailing list