Home | History | Annotate | Download | only in libm
History log of /src/tests/lib/libm/t_scalbn.c
RevisionDateAuthorComments
 1.18  09-Jun-2024  riastradh tests/lib/libm: Fix various xfails related to PR lib/45362.

Writing

if (condition) {
atf_tc_expect_fail(...);
atf_tc_fail(...);
}

in order to paper over a bug in qemu renders the test nearly useless
because it will never actually fail in the event that something
unexpected is broken.

atf_tc_expect_fail only makes senes _before_ doing the test. If we
want to paper over a bug in qemu, we can do:

if (isQEMU)
atf_tc_expect_fail("qemu is broken, PR lib/...");
ATF_CHECK(condition);

That way, we are still doing the test in non-qemu circumstances, and
if the qemu bug is fixed the test will give the feedback of an
unexpected pass.

While here: Use `volatile double x = ...' as input so the compiler
doesn't optimize calls like sin(x) away at build-time, and print the
bad values with ATF_CHECK_MSG on failure in case anything goes wrong.
 1.17  06-May-2024  riastradh tests/lib/libm/t_scalbn: Nix __HAVE_LONG_DOUBLE conditionals.

If long double is the same as double, i.e., __HAVE_LONG_DOUBLE is
undefined, these tests should still pass, since they don't rely on
extra precision beyond double.
 1.16  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.15  03-Jun-2018  maya branches: 1.15.2;
Test and clear exception around scalbn calls.
Second part of PR bin/51834.

ifdef out vax to avoid netbsd-specific macros.
 1.14  13-Jan-2017  agc branches: 1.14.12;
also terminate 2 other statements properly
 1.13  13-Jan-2017  agc terminate the statement properly
 1.12  13-Jan-2017  christos PR/51839: Ngie Cooper: reset errno to 0 before calling scalbn*
 1.11  03-Mar-2014  martin branches: 1.11.8;
Remove all cargo-cult #ifndef __vax__ from the tests, that just paper
over bugs in the vax libm.
 1.10  24-May-2013  martin Backout previous - real fix for vax libm upcoming.
 1.9  23-May-2013  christos vaxinate the new tests.
 1.8  20-May-2013  martin Add a few test cases to test "ordinary" values with the various scalbn
variants. While there, make some spuriously failing tests print out the
broken values on failure.
 1.7  13-Sep-2011  jruoho branches: 1.7.2; 1.7.8;
Improve metadata once again.
 1.6  13-Sep-2011  jruoho Test that scalbn(x) == ldexp(2) whenever FLT_RADIX == 2 (like it should be
on all systems except exotic relics such as IBM 360).
 1.5  13-Sep-2011  jruoho When failing, point to the tracker PR lib/45362.
 1.4  12-Sep-2011  jruoho Improve the metadata descriptions.
 1.3  12-Sep-2011  jruoho Happiness of VAX implies ugliness of the code.
 1.2  12-Sep-2011  jruoho Add more assertions.
 1.1  12-Sep-2011  jruoho Start systematic testing of libm(3) by first evaluating the corner cases
(NaN, +0.0, -0.0, +Inf, -Inf) for the ldexp(3) and scalbn(3) families.
 1.7.8.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.8.1  23-Jun-2013  tls resync from head
 1.7.2.1  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.11.8.1  20-Mar-2017  pgoyette Sync with HEAD
 1.14.12.2  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.14.12.1  25-Jun-2018  pgoyette Sync with HEAD
 1.15.2.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed