mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-14 17:11:06 +00:00
2f0a0f4427
This patch makes libm-test.inc apply sanity checks to ulps values resulting from tests, or found in libm-test-ulps files, to avoid the need for manual checking/editing of new ulps for cases that are excessively large or involve functions that should not have any ulps. For IBM long double, errors must be at most 14ulp (the largest currently checked-in value), or at most 3ulp (the documented error bound for division) in the case of exactly-determined functions; for other formats, the limits are 9ulp (also the largest currently checked-in value) and 0ulp. Limits from ulps files are saturated to those bounds, and regen-ulps will ignore any errors outside those bounds. (Thus if, say, you have an architecture-specific problem with fma, the tests can still be XFAILed in auto-libm-test-in, but errors outside the permitted range can no longer be listed in libm-test-ulps.) Tested x86_64. * math/libm-test.inc (max_valid_error): New variable. (init_max_error): Take new argument specifying whether function results are exactly determined. Set max_valid_error and bound other variables for errors based on this argument. (set_max_error): Do not record results above max_valid_error. (check_float_internal): Only accept errors of up to 0.5ulps if also at most max_valid_error. (START): Take new argument EXACT and pass it to init_max_error. (acos_test): Update call to START. (acos_test_tonearest): Likewise. (acos_test_towardzero): Likewise. (acos_test_downward): Likewise. (acos_test_upward): Likewise. (acosh_test): Likewise. (asin_test): Likewise. (asin_test_tonearest): Likewise. (asin_test_towardzero): Likewise. (asin_test_downward): Likewise. (asin_test_upward): Likewise. (asinh_test): Likewise. (atan_test): Likewise. (atanh_test): Likewise. (atan2_test): Likewise. (cabs_test): Likewise. (cacos_test): Likewise. (cacosh_test): Likewise. (carg_test): Likewise. (casin_test): Likewise. (casinh_test): Likewise. (catan_test): Likewise. (catanh_test): Likewise. (cbrt_test): Likewise. (ccos_test): Likewise. (ccosh_test): Likewise. (ceil_test): Likewise. (cexp_test): Likewise. (cimag_test): Likewise. (clog_test): Likewise. (clog10_test): Likewise. (conj_test): Likewise. (copysign_test): Likewise. (cos_test): Likewise. (cos_test_tonearest): Likewise. (cos_test_towardzero): Likewise. (cos_test_downward): Likewise. (cos_test_upward): Likewise. (cosh_test): Likewise. (cosh_test_tonearest): Likewise. (cosh_test_towardzero): Likewise. (cosh_test_downward): Likewise. (cosh_test_upward): Likewise. (cpow_test): Likewise. (cproj_test): Likewise. (creal_test): Likewise. (csin_test): Likewise. (csinh_test): Likewise. (csqrt_test): Likewise. (ctan_test): Likewise. (ctan_test_tonearest): Likewise. (ctan_test_towardzero): Likewise. (ctan_test_downward): Likewise. (ctan_test_upward): Likewise. (ctanh_test): Likewise. (ctanh_test_tonearest): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_test_downward): Likewise. (ctanh_test_upward): Likewise. (erf_test): Likewise. (erfc_test): Likewise. (exp_test): Likewise. (exp_test_tonearest): Likewise. (exp_test_towardzero): Likewise. (exp_test_downward): Likewise. (exp_test_upward): Likewise. (exp10_test): Likewise. (exp10_test_tonearest): Likewise. (exp10_test_towardzero): Likewise. (exp10_test_downward): Likewise. (exp10_test_upward): Likewise. (pow10_test): Likewise. (exp2_test): Likewise. (expm1_test): Likewise. (expm1_test_tonearest): Likewise. (expm1_test_towardzero): Likewise. (expm1_test_downward): Likewise. (expm1_test_upward): Likewise. (fabs_test): Likewise. (fdim_test): Likewise. (floor_test): Likewise. (fma_test): Likewise. (fma_test_towardzero): Likewise. (fma_test_downward): Likewise. (fma_test_upward): Likewise. (fmax_test): Likewise. (fmin_test): Likewise. (fmod_test): Likewise. (fpclassify_test): Likewise. (frexp_test): Likewise. (hypot_test): Likewise. (ilogb_test): Likewise. (isfinite_test): Likewise. (finite_test): Likewise. (isgreater_test): Likewise. (isgreaterequal_test): Likewise. (isinf_test): Likewise. (isless_test): Likewise. (islessequal_test): Likewise. (islessgreater_test): Likewise. (isnan_test): Likewise. (isnormal_test): Likewise. (issignaling_test): Likewise. (isunordered_test): Likewise. (j0_test): Likewise. (j1_test): Likewise. (jn_test): Likewise. (ldexp_test): Likewise. (lgamma_test): Likewise. (gamma_test): Likewise. (lrint_test): Likewise. (lrint_test_tonearest): Likewise. (lrint_test_towardzero): Likewise. (lrint_test_downward): Likewise. (lrint_test_upward): Likewise. (llrint_test): Likewise. (llrint_test_tonearest): Likewise. (llrint_test_towardzero): Likewise. (llrint_test_downward): Likewise. (llrint_test_upward): Likewise. (log_test): Likewise. (log10_test): Likewise. (log1p_test): Likewise. (log2_test): Likewise. (logb_test): Likewise. (logb_test_downward): Likewise. (lround_test): Likewise. (llround_test): Likewise. (modf_test): Likewise. (nearbyint_test): Likewise. (nextafter_test): Likewise. (nexttoward_test): Likewise. (pow_test): Likewise. (pow_test_tonearest): Likewise. (pow_test_towardzero): Likewise. (pow_test_downward): Likewise. (pow_test_upward): Likewise. (remainder_test): Likewise. (drem_test): Likewise. (remainder_test_tonearest): Likewise. (drem_test_tonearest): Likewise. (remainder_test_towardzero): Likewise. (drem_test_towardzero): Likewise. (remainder_test_downward): Likewise. (drem_test_downward): Likewise. (remainder_test_upward): Likewise. (drem_test_upward): Likewise. (remquo_test): Likewise. (rint_test): Likewise. (rint_test_tonearest): Likewise. (rint_test_towardzero): Likewise. (rint_test_downward): Likewise. (rint_test_upward): Likewise. (round_test): Likewise. (scalb_test): Likewise. (scalbn_test): Likewise. (scalbln_test): Likewise. (signbit_test): Likewise. (sin_test): Likewise. (sin_test_tonearest): Likewise. (sin_test_towardzero): Likewise. (sin_test_downward): Likewise. (sin_test_upward): Likewise. (sincos_test): Likewise. (sinh_test): Likewise. (sinh_test_tonearest): Likewise. (sinh_test_towardzero): Likewise. (sinh_test_downward): Likewise. (sinh_test_upward): Likewise. (sqrt_test): Likewise. (sqrt_test_tonearest): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_test_downward): Likewise. (sqrt_test_upward): Likewise. (tan_test): Likewise. (tan_test_tonearest): Likewise. (tan_test_towardzero): Likewise. (tan_test_downward): Likewise. (tan_test_upward): Likewise. (tanh_test): Likewise. (tgamma_test): Likewise. (trunc_test): Likewise. (y0_test): Likewise. (y1_test): Likewise. (yn_test): Likewise. (significand_test): Likewise. |
||
---|---|---|
.. | ||
bits | ||
machine | ||
atest-exp2.c | ||
atest-exp.c | ||
atest-sincos.c | ||
auto-libm-test-in | ||
auto-libm-test-out | ||
basic-test.c | ||
bug-nextafter.c | ||
bug-nexttoward.c | ||
bug-tgmath1.c | ||
cabs.c | ||
cabsf.c | ||
cabsl.c | ||
carg.c | ||
cargf.c | ||
cargl.c | ||
cimag.c | ||
cimagf.c | ||
cimagl.c | ||
complex.h | ||
conj.c | ||
conjf.c | ||
conjl.c | ||
creal.c | ||
crealf.c | ||
creall.c | ||
divtc3.c | ||
e_acoshl.c | ||
e_acosl.c | ||
e_asinl.c | ||
e_atan2l.c | ||
e_atanhl.c | ||
e_coshl.c | ||
e_exp2l.c | ||
e_exp10.c | ||
e_exp10f.c | ||
e_exp10l.c | ||
e_expl.c | ||
e_fmodl.c | ||
e_gammal_r.c | ||
e_hypotl.c | ||
e_j0l.c | ||
e_j1l.c | ||
e_jnl.c | ||
e_lgammal_r.c | ||
e_log2l.c | ||
e_log10l.c | ||
e_logl.c | ||
e_powl.c | ||
e_rem_pio2l.c | ||
e_scalb.c | ||
e_scalbf.c | ||
e_scalbl.c | ||
e_sinhl.c | ||
e_sqrtl.c | ||
fclrexcpt.c | ||
fedisblxcpt.c | ||
feenablxcpt.c | ||
fegetenv.c | ||
fegetexcept.c | ||
fegetround.c | ||
feholdexcpt.c | ||
fenv.h | ||
fesetenv.c | ||
fesetround.c | ||
feupdateenv.c | ||
fgetexcptflg.c | ||
fpu_control.c | ||
fraiseexcpt.c | ||
fsetexcptflg.c | ||
ftestexcept.c | ||
gen-auto-libm-tests.c | ||
gen-libm-test.pl | ||
ieee-math.c | ||
k_casinh.c | ||
k_casinhf.c | ||
k_casinhl.c | ||
k_cosl.c | ||
k_rem_pio2l.c | ||
k_sincosl.c | ||
k_sinl.c | ||
k_tanl.c | ||
libm-test.inc | ||
Makefile | ||
math.h | ||
multc3.c | ||
README.libm-test | ||
s_asinhl.c | ||
s_atanl.c | ||
s_cacos.c | ||
s_cacosf.c | ||
s_cacosh.c | ||
s_cacoshf.c | ||
s_cacoshl.c | ||
s_cacosl.c | ||
s_casin.c | ||
s_casinf.c | ||
s_casinh.c | ||
s_casinhf.c | ||
s_casinhl.c | ||
s_casinl.c | ||
s_catan.c | ||
s_catanf.c | ||
s_catanh.c | ||
s_catanhf.c | ||
s_catanhl.c | ||
s_catanl.c | ||
s_cbrtl.c | ||
s_ccos.c | ||
s_ccosf.c | ||
s_ccosh.c | ||
s_ccoshf.c | ||
s_ccoshl.c | ||
s_ccosl.c | ||
s_cexp.c | ||
s_cexpf.c | ||
s_cexpl.c | ||
s_clog10.c | ||
s_clog10f.c | ||
s_clog10l.c | ||
s_clog.c | ||
s_clogf.c | ||
s_clogl.c | ||
s_cpow.c | ||
s_cpowf.c | ||
s_cpowl.c | ||
s_cproj.c | ||
s_cprojf.c | ||
s_cprojl.c | ||
s_csin.c | ||
s_csinf.c | ||
s_csinh.c | ||
s_csinhf.c | ||
s_csinhl.c | ||
s_csinl.c | ||
s_csqrt.c | ||
s_csqrtf.c | ||
s_csqrtl.c | ||
s_ctan.c | ||
s_ctanf.c | ||
s_ctanh.c | ||
s_ctanhf.c | ||
s_ctanhl.c | ||
s_ctanl.c | ||
s_erfl.c | ||
s_expm1l.c | ||
s_fdim.c | ||
s_fdimf.c | ||
s_fdiml.c | ||
s_fma.c | ||
s_fmaf.c | ||
s_fmal.c | ||
s_fmax.c | ||
s_fmaxf.c | ||
s_fmaxl.c | ||
s_fmin.c | ||
s_fminf.c | ||
s_fminl.c | ||
s_ldexp.c | ||
s_ldexpf.c | ||
s_ldexpl.c | ||
s_log1pl.c | ||
s_nan.c | ||
s_nanf.c | ||
s_nanl.c | ||
s_nextafter.c | ||
s_nexttowardf.c | ||
s_nexttowardl.c | ||
s_significand.c | ||
s_significandf.c | ||
s_significandl.c | ||
s_tanhl.c | ||
setfpucw.c | ||
t_sincosl.c | ||
test-double.c | ||
test-fenv-tls.c | ||
test-fenv.c | ||
test-float.c | ||
test-fpucw-ieee-static.c | ||
test-fpucw-ieee.c | ||
test-fpucw-static.c | ||
test-fpucw.c | ||
test-idouble.c | ||
test-ifloat.c | ||
test-ildoubl.c | ||
test-ldouble.c | ||
test-matherr.c | ||
test-misc.c | ||
test-powl.c | ||
test-snan.c | ||
test-tgmath2.c | ||
test-tgmath-int.c | ||
test-tgmath-ret.c | ||
test-tgmath.c | ||
tgmath.h | ||
tst-CMPLX2.c | ||
tst-CMPLX.c | ||
tst-definitions.c | ||
Versions | ||
w_acos.c | ||
w_acosf.c | ||
w_acosh.c | ||
w_acoshf.c | ||
w_acoshl.c | ||
w_acosl.c | ||
w_asin.c | ||
w_asinf.c | ||
w_asinl.c | ||
w_atan2.c | ||
w_atan2f.c | ||
w_atan2l.c | ||
w_atanh.c | ||
w_atanhf.c | ||
w_atanhl.c | ||
w_cosh.c | ||
w_coshf.c | ||
w_coshl.c | ||
w_drem.c | ||
w_dremf.c | ||
w_dreml.c | ||
w_exp2.c | ||
w_exp2f.c | ||
w_exp2l.c | ||
w_exp10.c | ||
w_exp10f.c | ||
w_exp10l.c | ||
w_expl.c | ||
w_fmod.c | ||
w_fmodf.c | ||
w_fmodl.c | ||
w_hypot.c | ||
w_hypotf.c | ||
w_hypotl.c | ||
w_ilogb.c | ||
w_ilogbf.c | ||
w_ilogbl.c | ||
w_j0.c | ||
w_j0f.c | ||
w_j0l.c | ||
w_j1.c | ||
w_j1f.c | ||
w_j1l.c | ||
w_jn.c | ||
w_jnf.c | ||
w_jnl.c | ||
w_lgamma_r.c | ||
w_lgamma.c | ||
w_lgammaf_r.c | ||
w_lgammaf.c | ||
w_lgammal_r.c | ||
w_lgammal.c | ||
w_log2.c | ||
w_log2f.c | ||
w_log2l.c | ||
w_log10.c | ||
w_log10f.c | ||
w_log10l.c | ||
w_log.c | ||
w_logf.c | ||
w_logl.c | ||
w_pow.c | ||
w_powf.c | ||
w_powl.c | ||
w_remainder.c | ||
w_remainderf.c | ||
w_remainderl.c | ||
w_scalb.c | ||
w_scalbf.c | ||
w_scalbl.c | ||
w_sinh.c | ||
w_sinhf.c | ||
w_sinhl.c | ||
w_sqrt.c | ||
w_sqrtf.c | ||
w_sqrtl.c | ||
w_tgamma.c | ||
w_tgammaf.c | ||
w_tgammal.c |
README for libm-test math test suite ==================================== The libm-test math test suite tests a number of function points of math functions in the GNU C library. The following sections contain a brief overview. Please note that the test drivers and the Perl script "gen-libm-test.pl" have some options. A full list of options is available with --help (for the test drivers) and -h for "gen-libm-test.pl". What is tested? =============== The tests just evaluate the functions at specified points and compare the results with precomputed values and the requirements of the ISO C99 standard. Besides testing the special values mandated by IEEE 754 (infinities, NaNs and minus zero), some more or less random values are tested. Files that are part of libm-test ================================ The main file is "libm-test.inc". It is platform and floating point format independent. The file must be preprocessed by the Perl script "gen-libm-test.pl". The results are "libm-test.c" and a file "libm-test-ulps.h" with platform specific deltas. The test drivers test-double.c, test-float.c, test-ldouble.c test the normal double, float and long double implementation of libm. The test drivers with an i in it (test-idouble.c, test-ifloat.c, test-ildoubl.c) test the corresponding inline functions (where available - otherwise they also test the real functions in libm). "gen-libm-test.pl" needs a platform specific files with ULPs (Units of Last Precision). The file is called "libm-test-ulps" and lives in platform specific sysdep directory. How can I generate "libm-test-ulps"? ==================================== To automatically generate a new "libm-test-ulps" run "make regen-ulps". This generates the file "math/NewUlps" in the build directory. The file contains the sorted results of all the tests. You can use the "NewUlps" file as the machine's updated "libm-test-ulps" file. Copy "NewUlps" to "libm-test-ulps" in the appropriate machine sysdep directory. Verify the changes, post your patch, and check it in after review. To manually generate a new "libm-test-ulps" file, first remove "ULPs" file in the current directory, then you can execute for example: ./testrun.sh math/test-double -u --ignore-max-ulp=yes This generates a file "ULPs" with all double ULPs in it, ignoring any previously calculated ULPs, and running with the newly built dynamic loader and math library (assumes you didn't install your build). Now generate the ULPs for all other formats, the tests will be appending the data to the "ULPs" file. As final step run "gen-libm-test.pl" with the file as input and ask to generate a pretty printed output in the file "NewUlps": gen-libm-test.pl -u ULPs -n Copy "NewUlps" to "libm-test-ulps" in the appropriate machine sysdep directory. Note that the test drivers have an option "-u" to output an unsorted list of all epsilons that the functions have. The output can be read in directly but it's better to pretty print it first. "gen-libm-test.pl" has an option to generate a pretty-printed and sorted new ULPs file from the output of the test drivers. Contents of libm-test-ulps ========================== Since libm-test-ulps can be generated automatically, just a few notes. The file contains lines for maximal errors of single functions, like: Function "yn": idouble: 6 The keywords are float, ifloat, double, idouble, ldouble and ildouble (the prefix i stands for inline). Adding tests to libm-test.inc ============================= The tests are evaluated by a set of special test macros. The macros start with "TEST_" followed by a specification the input values, an underscore and a specification of the output values. As an example, the test macro for a function with input of type FLOAT (FLOAT is either float, double, long double) and output of type FLOAT is "TEST_f_f". The macro's parameter are the name of the function, the input parameter, output parameter and optionally one exception parameter. The accepted parameter types are: - "f" for FLOAT - "b" for boolean - just tests if the output parameter evaluates to 0 or 1 (only for output). - "c" for complex. This parameter needs two values, first the real, then the imaginary part. - "i" for int. - "l" for long int. - "L" for long long int. - "F" for the address of a FLOAT (only as input parameter) - "I" for the address of an int (only as input parameter)