This is the mail archive of the
mailing list for the glibc project.
Re: Math error-reporting test scripts useful in glibc?
- From: "Michael Kerrisk" <mtk dot manpages at googlemail dot com>
- To: "Agner Fog" <agner at agner dot org>
- Cc: libc-help <libc-help at sourceware dot org>
- Date: Tue, 26 Aug 2008 08:40:47 +0200
- Subject: Re: Math error-reporting test scripts useful in glibc?
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=73KpblSzipaLzAx78VGceRzRzx5jMKPeXXfRiyfNKrM=; b=jkpQOHJQsg4hweohV0lzHWJ6YvUQFIyrW5wnPcpnMT698YfaiT46XkPqqWUhGVAFjO 8/heoV+cGyKi1S59f/phYXcnTYpfSKOQsWQ1UyvdD250pyJvaYfFeS4N4aVA3LcgKvME TL5hbSSxMvjzfmrZCSC9UK0ly6pQB+fooMcqY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references; b=txnOYbKWJ3gmnTvUfKzheu5MyIr1V6k6Egz6EliKuRL0yECae/foSGo/cu48mtfWJe 5ZsoMpTnQOKx+4E/4WEAtMC3NCWbtZpBBLykktcl3ecFQunrwyBcL/ehxwvYVwxmDcsJ Z9JsRp54kI30H2L5oq+uieQu0ae4mN5WYcRbg=
- References: <firstname.lastname@example.org> <48B39E33.email@example.com>
- Reply-to: mtk dot manpages at gmail dot com
On Tue, Aug 26, 2008 at 8:09 AM, Agner Fog <firstname.lastname@example.org> wrote:
> 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:
>> ERANGE FE_DIVBYZERO -inf
>> 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 --
>> http://thread.gmane.org/gmane.comp.lib.glibc.alpha/13583/focus=13594 .
>> 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)?
> 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?
I don't know. I'm not familiar with the low level details of the
instruction sets used, and how to control that, or whether there are
different versions of the math functions for the different instruction
sets. I wrote these scripts to do testing in a pretty much black-box
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html