Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: src/tests/lib/libm
Module Name: src
Committed By: riastradh
Date: Wed Nov 7 03:59:37 UTC 2018
Modified Files:
src/tests/lib/libm: t_acos.c t_asin.c t_cbrt.c t_cos.c t_cosh.c t_exp.c
t_ldexp.c t_libm.h t_log.c t_scalbn.c t_sin.c t_sinh.c t_sqrt.c
t_tan.c
Log Message:
Fix up libm tests.
- Fix up last few digits of a lot of known-answer tests.
Confirmed with GNU mpfr to 200 bits of precision and cross-checked
with whatever libm Ubuntu ships with.
- Test relative error, not absolute error.
- Set bounds in terms of *_EPSILON, not magic numbers.
*_EPSILON is twice the largest relative error of a correctly
rounded operation, and equal to the largest relative error of an
operation with up to 1ulp error.
Most of the operations we're testing are not correctly rounded, but
they ought to be no more than 1ulp away. For the few cases where
that's not a priori clear (like comparing cbrt and pow(x, 1/3)),
use twice *_EPSILON to allow some leeway.
- Write the success condition positively as error <= eps.
This comes out false if the result is a NaN, meaning failure. In
contrast, if we write error > eps for the _failure_ condition, then
if the result is a NaN, it will also come out false, but meaning
success, which is not what we want.
- Fix the trigonometric test cases near bad spots.
sin(pi - d) for nonzero d is not zero; it is d + O(d^3). pi is not
a floating-point number, so these results should be approximately
the nonzero error of our approximation to pi. Likewise with
cos(pi/2 - d) and tan(pi + d).
(Yes, I know the sin _function_ is ill-conditioned near pi so you
shouldn't pass approximate inputs near there, but that's separate
from whether a sin _implementation_ gives an answer that is wrong
by quintillions of ulps.)
Since on x86 (i386 and amd64 alike) we currently use x87 hardware
trigonometric instructions, which are bad, these are marked xfail
on x86 for now until we switch to software implementations (coming
soon to a repository near you).
- Use %.8g, %.17g, %.35g to print float, double, long double in failures.
This should be enough to identify the problematic outputs and/or
reproduce the computation, even if long double is binary128 with
115 bits of precision.
If there are any new libm test failures after this, tell me what
architecture you're on and send me the atf output and I'll try to
figure it out.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libm/t_acos.c
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libm/t_asin.c \
src/tests/lib/libm/t_cbrt.c
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libm/t_cos.c \
src/tests/lib/libm/t_sin.c
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libm/t_cosh.c \
src/tests/lib/libm/t_libm.h src/tests/lib/libm/t_sinh.c
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libm/t_exp.c
cvs rdiff -u -r1.16 -r1.17 src/tests/lib/libm/t_ldexp.c
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libm/t_log.c
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libm/t_scalbn.c
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libm/t_sqrt.c
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libm/t_tan.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index