(unknown charset) Re: cvs commit: src/lib/msun/src fabsl.c
On Fri, 24 Oct 2003, Dag-Erling [iso-8859-1] Smørgrav 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 instead, but it requires quite a bit
> more work as fpmath.h isn't normally installed.
Suboptimimal solutions are easy:
return (x < 0 ? -x : x == 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.
Received on Fri Oct 24 2003 - 04:09:25 UTC