cvs commit: src/lib/msun/src fabsl.c

Bruce Evans bde at zeta.org.au
Fri Oct 24 04:09:25 PDT 2003


On Fri, 24 Oct 2003, Dag-Erling [iso-8859-1] Sm=F8rgrav wrote:

> David Schultz <das at FreeBSD.ORG> writes:
> > Cool.  This has a minor bug in that it does the wrong thing for -0.

I reported this and some style bugs.

> I'd like to use your solution[1] instead, but it requires quite a bit
> more work as fpmath.h isn't normally installed.

Suboptimimal solutions are easy:

=09return (x < 0 ? -x : x =3D=3D 0 ? 0 : x);

This is about twice as suboptimal as the current version (2 comparisons
instead of 1).

This also fixes a style bug that I missed before: missing spaces around
return value.  This is not bug for bug compatible with the fdlibm style,
but neither is the current version.  Spaces around most binary operators
must be omitted for full compatibility.

BTW, the classification stuff in <math.h> gives a lot of namespace
pollution in the _ANSI_SOURCE case.  <math.h> is not correctly ifdefed
for C99, but it used to be correctly ifdefed for C90.

Bruce


More information about the cvs-src mailing list