This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Math error-reporting test scripts useful in glibc?

Looks great!
Do the math functions have different versions for microprocessors with and without SSE2 and later instruction sets? If so, is there a testability feature built into the CPU dispatching mechanism - in other words: is there a way of testing the old non-SSE2 version on a computer with SSE2? Are the non-SSE2 math functions normally inlined? If they are inlined, I guess they would not set errno?

Michael Kerrisk wrote in libc-alpha:
A few weeks back I wrote some scripts to test error reporting by
nearly all math functions in glibc.  (Some details below.)  These
scripts are available here:

The main points about these scripts are that:

a) They automate generation of test programs for math functions, so
that together two scripts generate tests for about 70 math functions
(in any of the three type flavors, float, double, and long double).

b) They produce C programs that can be driven from the command-line to
perform almost any test of the math function.  Thus, as well as
accepting numeric vales for the function arguments, one can use words
such as "+inf", "-inf", "nan", "max" (the largest value of the
function's type), "subnormal:N" (a subnormal power-of-two number with
N leading zeroes in the significand), etc.  The resulting programs can
be useful for working with glibc bug reports for math functions where
no test program is supplied, or the test program is very limited in
its operation.

c) The generated test programs produce output that can easily be
script processed -- each program produces a summary line containing
the errno setting, the exception raised (if any), and the (class of
the) result value.  For example, the log(3) test program produces the
following output when given a command-line argument of 0:
And an argument of 10 produces the output:
0 0 normal
(where normal is indicates that the result is a normalized floating
point number; it is also possible to use the programs to test that the
result matches a specific value, if merely knowing that the value is
"normal" is insufficient).

d) They can be extended fairly easily to cover other math functions
(though in fact I think I've covered most math functions already,
including all of those in POSIX.1-2001, and most of the glibc
extensions -- however, note that these scripts don't deal with the
complex math functions).

My question is: would / could these tests be usefully integrated into
glibc?  If necessary, I may have some time to do some reworking to
make them more suited to glibc requirements.



PS The scripts check things such as:

* Are errors reported via errno, via exceptions, or both?  For cases
where errors are reported using only one of these mechanisms, or
reported the wrong errors (see next point) or where errors are not
reported at all, I logged bugs  -- .
 The results of my tests are here:

* Do the functions report errors for the appropriate cases (e.g.,
underflow overflow, domain error, pole error), and (more difficult to
determine, so not complete) are there cases where errors are being
reported when they shouldn't be?

* Are errors reported correctly?  (i.e., is errno set to the right
value, or is the correct exception raised)?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]