Home | History | Annotate | Download | only in libm
History log of /src/tests/lib/libm/t_libm.h
RevisionDateAuthorComments
 1.7  07-Nov-2018  riastradh 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.
 1.6  25-Mar-2014  joerg branches: 1.6.4; 1.6.8; 1.6.28; 1.6.30;
Consistently use long double.
 1.5  16-Mar-2014  dsl Print the result as a 'long double' - on i386 a return value that
should be infinity might just be too large for 'double' and won't
get converted until it has to be saved to memory.
 1.4  16-Mar-2014  dsl Check that the result isn't equaly to the expected value before checking
the absolute size of the error term.
If the expected result is +/-infinity it should compare equal, but the
result of the subtract may not be zero.
Also print the result and error values in fp hex to make it easier to
see how may lsb bits are incorrect.
 1.3  07-Mar-2014  martin Vax does not do +/- INF.
 1.2  05-Mar-2014  dsl Fix some typos.
Make the infinity and nan constants 'double' not 'long double'.
 1.1  05-Mar-2014  dsl Move the #defines that simplified the test definitions and checks
into a separate header than can be used by the other libm tests.
Make the subtest index 'unsigned int' so that simple constants (eg 0)
print correctly.
 1.6.30.1  10-Jun-2019  christos Sync with HEAD
 1.6.28.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.6.8.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.8.1  25-Mar-2014  tls file t_libm.h was added on branch tls-maxphys on 2014-08-20 00:04:50 +0000
 1.6.4.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.4.1  25-Mar-2014  yamt file t_libm.h was added on branch yamt-pagecache on 2014-05-22 11:42:21 +0000

RSS XML Feed