Resize DTV if the current DTV isn't big enough
[glibc.git] / math / README.libm-test
blobb8353b13b410955bd54e5c2ac363f752ff49c5b2
1 README for libm-test math test suite
2 ====================================
4 The libm-test math test suite tests a number of function points of
5 math functions in the GNU C library.  The following sections contain a
6 brief overview.  Please note that the test drivers and the Perl script
7 "gen-libm-test.pl" have some options.  A full list of options is
8 available with --help (for the test drivers) and -h for
9 "gen-libm-test.pl".
12 What is tested?
13 ===============
14 The tests just evaluate the functions at specified points and compare
15 the results with precomputed values and the requirements of the ISO
16 C99 standard.
18 Besides testing the special values mandated by IEEE 754 (infinities,
19 NaNs and minus zero), some more or less random values are tested.
21 Files that are part of libm-test
22 ================================
24 The main file is "libm-test.inc".  It is platform and floating point
25 format independent.  The file must be preprocessed by the Perl script
26 "gen-libm-test.pl".  The results are "libm-test.c" and a file
27 "libm-test-ulps.h" with platform specific deltas.
29 The test drivers test-double.c, test-float.c, test-ldouble.c test the
30 normal double, float and long double implementation of libm.  The test
31 drivers with an i in it (test-idouble.c, test-ifloat.c,
32 test-ildoubl.c) test the corresponding inline functions (where
33 available - otherwise they also test the real functions in libm).
35 "gen-libm-test.pl" needs a platform specific files with ULPs (Units of
36 Last Precision).  The file is called "libm-test-ulps" and lives in
37 platform specific sysdep directory.
39 How can I generate "libm-test-ulps"?
40 ====================================
42 To automatically generate a new "libm-test-ulps" run "make regen-ulps".
43 This generates the file "math/NewUlps" in the build directory.  The file
44 contains the sorted results of all the tests.  You can use the "NewUlps"
45 file as the machine's updated "libm-test-ulps" file.  Copy "NewUlps" to
46 "libm-test-ulps" in the appropriate machine sysdep directory.  Verify
47 the changes, post your patch, and check it in after review.
49 To manually generate a new "libm-test-ulps" file, first remove "ULPs"
50 file in the current directory, then you can execute for example:
51     ./testrun.sh math/test-double -u --ignore-max-ulp=yes
52 This generates a file "ULPs" with all double ULPs in it, ignoring any
53 previously calculated ULPs, and running with the newly built dynamic
54 loader and math library (assumes you didn't install your build).  Now
55 generate the ULPs for all other formats, the tests will be appending the
56 data to the "ULPs" file.  As final step run "gen-libm-test.pl" with the
57 file as input and ask to generate a pretty printed output in the file
58 "NewUlps":
59   gen-libm-test.pl -u ULPs -n
60 Copy "NewUlps" to "libm-test-ulps" in the appropriate machine sysdep
61 directory.
63 Note that the test drivers have an option "-u" to output an unsorted
64 list of all epsilons that the functions have.  The output can be read
65 in directly but it's better to pretty print it first.
66 "gen-libm-test.pl" has an option to generate a pretty-printed and
67 sorted new ULPs file from the output of the test drivers.
69 Contents of libm-test-ulps
70 ==========================
72 Since libm-test-ulps can be generated automatically, just a few notes.
73 The file contains lines for maximal errors of single functions, like:
75 Function "yn":
76 idouble: 6
78 The keywords are float, ifloat, double, idouble, ldouble and ildouble
79 (the prefix i stands for inline).
81 Adding tests to libm-test.inc
82 =============================
84 The tests are evaluated by a set of special test macros.  The macros
85 start with "TEST_" followed by a specification the input values, an
86 underscore and a specification of the output values.  As an example,
87 the test macro for a function with input of type FLOAT (FLOAT is
88 either float, double, long double) and output of type FLOAT is
89 "TEST_f_f".  The macro's parameter are the name of the function, the
90 input parameter, output parameter and optionally one exception
91 parameter.
93 The accepted parameter types are:
94 - "f" for FLOAT
95 - "b" for boolean - just tests if the output parameter evaluates to 0
96   or 1 (only for output).
97 - "c" for complex.  This parameter needs two values, first the real,
98   then the imaginary part.
99 - "i" for int.
100 - "l" for long int.
101 - "L" for long long int.
102 - "F" for the address of a FLOAT (only as input parameter)
103 - "I" for the address of an int (only as input parameter)