This is the mail archive of the libc-alpha@sourceware.org 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]

Convert TEST_c_c tests from code to data


This patch converts the TEST_c_c tests in libm-test.inc from code to
data.  Tested x86_64 and x86.  Patch attached gzipped because it's
over 1MB.  (Subsequent patches in this series should be much smaller -
TEST_f_f, TEST_ff_f and TEST_c_c together cover the vast bulk of the
tests in libm-test.inc.)

The only part requiring specific explanation is the use of
BUILD_COMPLEX_ULP for ulps values.  Ideally all of complex inputs,
expected results and ulps would statically initialize fields of the
appropriate complex type.  Once we can assume GCC 4.7 or later for
building glibc, we can do just that, using the C11 CMPLX macros.
Until then, getting the sign of zero right in static initializers is
problematic (-0.0 + 0.0 * I gets a real part -0.0 + 0.0 from the
addition, which is 0.0 in round-to-nearest).  So for arguments and
expected results, we still need to use initializers of real type and
BUILD_COMPLEX to create complex values at runtime.  But for ulps, sign
of zero isn't an issue, so the simpler BUILD_COMPLEX_ULP can be used
to have a field of complex type without needing to change the C code
expecting a value of complex type here.

2013-05-12  Joseph Myers  <joseph@codesourcery.com>

	* math/libm-test.inc (BUILD_COMPLEX_ULP): New macro.
	(struct test_c_c_data): New type.
	(RUN_TEST_LOOP_c_c): New macro.
	(cacos_test_data): New variable.
	(cacos_test): Run tests with RUN_TEST_LOOP_c_c.
	(cacosh_test_data): New variable.
	(cacosh_test): Run tests with RUN_TEST_LOOP_c_c.
	(casin_test_data): New variable.
	(casin_test): Run tests with RUN_TEST_LOOP_c_c.
	(casinh_test_data): New variable.
	(casinh_test): Run tests with RUN_TEST_LOOP_c_c.
	(catan_test_data): New variable.
	(catan_test): Run tests with RUN_TEST_LOOP_c_c.
	(catanh_test_data): New variable.
	(catanh_test): Run tests with RUN_TEST_LOOP_c_c.
	(ccos_test_data): New variable.
	(ccos_test): Run tests with RUN_TEST_LOOP_c_c.
	(ccosh_test_data): New variable.
	(ccosh_test): Run tests with RUN_TEST_LOOP_c_c.
	(cexp_test_data): New variable.
	(cexp_test): Run tests with RUN_TEST_LOOP_c_c.
	(clog_test_data): New variable.
	(clog_test): Run tests with RUN_TEST_LOOP_c_c.
	(clog10_test_data): New variable.
	(clog10_test): Run tests with RUN_TEST_LOOP_c_c.
	(conj_test_data): New variable.
	(conj_test): Run tests with RUN_TEST_LOOP_c_c.
	(cproj_test_data): New variable.
	(cproj_test): Run tests with RUN_TEST_LOOP_c_c.
	(csin_test_data): New variable.
	(csin_test): Run tests with RUN_TEST_LOOP_c_c.
	(csinh_test_data): New variable.
	(csinh_test): Run tests with RUN_TEST_LOOP_c_c.
	(csqrt_test_data): New variable.
	(csqrt_test): Run tests with RUN_TEST_LOOP_c_c.
	(ctan_test_data): New variable.
	(ctan_test): Run tests with RUN_TEST_LOOP_c_c.
	(ctan_tonearest_test_data): New variable.
	(ctan_test_tonearest): Run tests with RUN_TEST_LOOP_c_c.
	(ctan_towardzero_test_data): New variable.
	(ctan_test_towardzero): Run tests with RUN_TEST_LOOP_c_c.
	(ctan_downward_test_data): New variable.
	(ctan_test_downward): Run tests with RUN_TEST_LOOP_c_c.
	(ctan_upward_test_data): New variable.
	(ctan_test_upward): Run tests with RUN_TEST_LOOP_c_c.
	(ctanh_test_data): New variable.
	(ctanh_test): Run tests with RUN_TEST_LOOP_c_c.
	(ctanh_tonearest_test_data): New variable.
	(ctanh_test_tonearest): Run tests with RUN_TEST_LOOP_c_c.
	(ctanh_towardzero_test_data): New variable.
	(ctanh_test_towardzero): Run tests with RUN_TEST_LOOP_c_c.
	(ctanh_downward_test_data): New variable.
	(ctanh_test_downward): Run tests with RUN_TEST_LOOP_c_c.
	(ctanh_upward_test_data): New variable.
	(ctanh_test_upward): Run tests with RUN_TEST_LOOP_c_c.
	* math/gen-libm-test.pl (get_ulps): Use BUILD_COMPLEX_ULP instead
	of BUILD_COMPLEX.


-- 
Joseph S. Myers
joseph@codesourcery.com

Attachment: glibc-test-c-c.gz
Description: Binary data


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