cvs commit: src/lib/msun/src e_rem_pio2.c e_rem_pio2f.c k_rem_pio2.c
bde at FreeBSD.org
Mon Feb 25 11:43:22 UTC 2008
bde 2008-02-25 11:43:20 UTC
FreeBSD src repository
lib/msun/src e_rem_pio2.c e_rem_pio2f.c k_rem_pio2.c
Fix some off-by-1 errors.
Float and double precision didn't work because init_jk was 1 too small.
It needs to be 2 larger than you might expect, and 1 larger than it was
for these precisions, since its test for recomputing needs a margin of
47 bits (almost 2 24-bit units).
init_jk seems to be barely enough for extended and quad precisions.
This hasn't been completely verified. Callers now get about 24 bits
of extra precision for float, and about 19 for double, but only about
8 for extended and quad. 8 is not enough for callers that want to
produce extra-precision results, but current callers have rounding
errors of at least 0.8 ulps, so another 1/2**8 ulps of error from the
reduction won't affect them much.
Add a comment about some of the magic for init_jk.
Double precision worked in practice because of a compensating off-by-1
error here. Extended precision was asked for, and it executed exactly
the same code as the unbroken double precision.
Float precision worked in practice because of a compensating off-by-1
error here. Double precision was asked for, and was almost needed,
since the cosf() and sinf() callers want to produce extra-precision
results, at least internally so that their error is only 0.5009 ulps.
However, the extra precision provided by unbroken float precision is
enough, and the double-precision code has extra overheads, so the
off-by-1 error cost about 5% in efficiency on amd64 and i386.
Revision Changes Path
1.16 +1 -1 src/lib/msun/src/e_rem_pio2.c
1.25 +2 -2 src/lib/msun/src/e_rem_pio2f.c
1.11 +8 -3 src/lib/msun/src/k_rem_pio2.c
More information about the cvs-src