freebsd-nq/lib/msun
Bruce Evans 4f8f819975 Fixed lots of 1 ULP errors caused by a broken approximation for pi/2.
We approximate pi with more than float precision using pi_hi+pi_lo in
the usual way (pi_hi is actually spelled pi in the source code), and
expect (float)0.5*pi_lo to give the low part of the corresponding
approximation for pi/2.  However, the high part for pi/2 (pi_o_2) is
rounded to nearest, which happens to round up, while the high part for
pi was rounded down.  Thus pi_o_2+(float)0.5*pi (in infinite precision)
was a very bad approximation for pi/2 -- the low term has the wrong
sign and increases the error drom less than half an ULP to a full ULP.

This fix rounds up instead of down for pi_hi.  Consistently rounding
down instead of up should work, and is the method used in e_acosf.c
and e_asinf.c.  The reason for the difference is that we sometimes
want to return precisely pi/2 in e_atan2f.c, so it is convenient to
have a correctly rounded (to nearest) value for pi/2 in a variable.
a_acosf.c and e_asinf.c also differ in directly approximating pi/2
instead pi; they multiply by 2.0 instead of dividing by 0.5 to convert
the approximation.

These complications are not directly visible in the double precision
versions because rounding to nearest happens to round down.
2004-06-02 17:09:05 +00:00
..
alpha
bsdsrc Remove some kludges designed to ensure that the compiler didn't round 2004-05-17 01:04:37 +00:00
i387
man Add an implementation of copysignl(), a long double version of copysign(). 2004-05-07 18:56:31 +00:00
src Fixed lots of 1 ULP errors caused by a broken approximation for pi/2. 2004-06-02 17:09:05 +00:00
Makefile Add implementations for cimag{,f,l}, creal{,f,l} and conj{,f,l}. They are 2004-05-30 09:21:56 +00:00