Commit Graph

973 Commits

Author SHA1 Message Date
Joseph Myers e9996ef750 Add libm-test.inc macro for all-rounding-modes testing.
This patch adds support in libm-test.inc for automatically running
tests of a function in all rounding modes, in the form of a macro
ALL_RM_TEST to loop over all rounding modes when running tests of a
function, and uses it for functions whose results should always be
independent of the rounding mode.

Conversion of tests of nextafter to ALL_RM_TEST was deferred because
trying that conversion showed up bug 16677.  (Finding such a bug of
course illustrates the point of testing more systematically in all
rounding modes rather than only reactively when bugs get reported in a
particular function in a non-default mode.)  Conversion of tests where
results can depend on the rounding mode will follow once I add
gen-libm-test.pl support for using different initializers for the
expected results for different rounding modes (again, some conversions
may need deferring until bugs are fixed, depending on how
straightforward they are to XFAIL in a particular context).

Some existing tests get run five times rather than four, with
round-to-nearest tests both run in that as default rounding mode and
also with it explicitly set with fesetround (FE_TONEAREST).  This
duplication doesn't seem particularly useful, so ALL_RM_TEST only runs
tests four times.

Tested x86_64 and x86.

	* math/libm-test.inc (ALL_RM_TEST): New macro.
	(ceil_test): Use ALL_RM_TEST.
	(cimag_test): Likewise.
	(conj_test): Likewise.
	(copysign_test): Likewise.
	(cproj_test): Likewise.
	(creal_test): Likewise.
	(fabs_test): Likewise.
	(floor_test): Likewise.
	(fmax_test): Likewise.
	(fmin_test): Likewise.
	(fmod_test): Likewise.
	(fpclassify_test): Likewise.
	(frexp_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.
	(logb_test): Likewise.
	(logb_downward_test_data): Remove.
	(logb_test_downward): Likewise.
	(lround_test): Use ALL_RM_TEST.
	(llround_test): Likewise.
	(modf_test): Likewise.
	(nexttoward_test): Likewise.
	(remainder_test): Likewise.
	(drem_test): Likewise.
	(remainder_tonearest_test_data): Likewise.
	(remainder_test_tonearest): Likewise.
	(drem_test_tonearest): Likewise.
	(remainder_towardzero_test_data): Likewise.
	(remainder_test_towardzero): Likewise.
	(drem_test_towardzero): Likewise.
	(remainder_downward_test_data): Likewise.
	(remainder_test_downward): Likewise.
	(drem_test_downward): Likewise.
	(remainder_upward_test_data): Likewise.
	(remainder_test_upward): Likewise.
	(drem_test_upward): Likewise.
	(remquo_test): Use ALL_RM_TEST.  Remove comment about x.
	(round_test): Use ALL_RM_TEST.
	(signbit_test): Likewise.
	(trunc_test): Likewise.
	(significand_test): Likewise.
	(main): Don't call removed functions.
2014-03-08 14:08:38 +00:00
Joseph Myers 215db4029e Prepare libm-test.inc structures for multi-rounding-mode testing.
At present, libm-test.inc tests are run in multiple rounding modes by
having a separate array for each rounding mode (which might or might
not have the same test inputs as the other such arrays), a separate
function calling a RUN_TEST_LOOP_* macro over that array, and a
separate call to that function in main.  The number of functions
tested in multiple rounding modes has gradually increased as
rounding-mode-specific bugs have been found and fixed in different
functions.

It would be better to be able to use a single macro call, in a single
function, to run tests for a function over all rounding modes, with
this being done for all libm functions except in cases where it's
deferred until some bugs can be fixed because XFAILing all affected
tests would be painful (that's why the full set of pow tests isn't
currently run in all rounding modes).  This patch helps prepare for
that by making the structures storing expected results for tests store
results for all four rounding modes.  After this patch, the results
for all modes are just duplicates, but tests access the appropriate
field in the structure, so helping to pave the way for when the fields
stop being duplicates and multiple rounding modes can be tested from a
single array.  Tests might in future specify a single set of results,
to be used in all rounding modes; separate results for each rounding
mode, specified manually; or use of auto-libm-tests-* to generate
results for each rounding mode.

Tested x86_64.

	* math/libm-test.inc (struct test_f_f_data): Move expected results
	into structure for each rounding mode.
	(struct test_ff_f_data): Likewise.
	(struct test_ff_f_data_nexttoward): Likewise.
	(struct test_fi_f_data): Likewise.
	(struct test_fl_f_data): Likewise.
	(struct test_if_f_data): Likewise.
	(struct test_fff_f_data): Likewise.
	(struct test_c_f_data): Likewise.
	(struct test_f_f1_data): Likewise.
	(struct test_fF_f1_data): Likewise.
	(struct test_ffI_f1_data): Likewise.
	(struct test_c_c_data): Likewise.
	(struct test_cc_c_data): Likewise.
	(struct test_f_i_data): Likewise.
	(struct test_ff_i_data): Likewise.
	(struct test_f_l_data): Likewise.
	(struct test_f_L_data): Likewise.
	(struct test_fFF_11_data): Likewise.
	(RM_): New macro.
	(RM_FE_DOWNWARD): Likewise.
	(RM_FE_TONEAREST): Likewise.
	(RM_FE_TOWARDZERO): Likewise.
	(RM_FE_UPWARD): Likewise.
	(RUN_TEST_LOOP_f_f): Update references to expected results.
	(RUN_TEST_LOOP_2_f): Likewise.
	(RUN_TEST_LOOP_fff_f): Likewise.
	(RUN_TEST_LOOP_c_f): Likewise.
	(RUN_TEST_LOOP_f_f1): Likewise.
	(RUN_TEST_LOOP_fF_f1): Likewise.
	(RUN_TEST_LOOP_fI_f1): Likewise.
	(RUN_TEST_LOOP_ffI_f1): Likewise.
	(RUN_TEST_LOOP_c_c): Likewise.
	(RUN_TEST_LOOP_cc_c): Likewise.
	(RUN_TEST_LOOP_f_i): Likewise.
	(RUN_TEST_LOOP_f_i_tg): Likewise.
	(RUN_TEST_LOOP_ff_i_tg): Likewise.
	(RUN_TEST_LOOP_f_b): Likewise.
	(RUN_TEST_LOOP_f_b_tg): Likewise.
	(RUN_TEST_LOOP_f_l): Likewise.
	(RUN_TEST_LOOP_f_L): Likewise.
	(RUN_TEST_LOOP_fFF_11): Likewise.
	* math/gen-libm-test.pl (parse_args): Output four copies of
	expected results for each test.
2014-03-06 14:15:00 +00:00
Joseph Myers aa97dee16e Adjust how gen-auto-libm-tests handles before-rounding/after-rounding cases.
This patch changes gen-auto-libm-tests so that, when generating test
results that depend on whether the architecture has before-rounding or
after-rounding tininess detection, the :before-rounding or
:after-rounding conditions go on the exception / errno flags
generated, rather than generating two separate lines in
auto-libm-test-out for e.g. flt-32:before-rounding and
flt-32:after-rounding.

The rationale for this is as follows.  It would be desirable for
testing a libm function in all rounding modes to require just one
function and array in libm-test.inc, not four (or five), with the
array of test data including expected results for all rounding modes
rather than separate arrays for each rounding mode that also need to
repeat all the test inputs.  For gen-libm-test.pl to generate data for
such an array from auto-libm-test-out, it would be helpful if each
(format, test input) pair has exactly four lines in
auto-libm-test-out, one for each rounding mode, rather than some
rounding modes having just one line and some having two because the
exceptions depend on tininess detection.

Tested x86_64 and x86.

	* math/gen-auto-libm-tests.c: Update comment on output format.
	(output_for_one_input_case): Generate before-rounding and
	after-rounding information as conditions on output flags not
	floating-point format.
	* math/auto-libm-test-out: Regenerated.
	* math/gen-libm-test.pl (cond_value): New function.
	(or_cond_value): Use cond_value.
	(generate_testfile): Handle conditional exceptions.
2014-03-06 14:11:19 +00:00
Joseph Myers 2f0a0f4427 Automatically check sanity of ulps from libm tests.
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.
2014-03-05 15:05:20 +00:00
Joseph Myers e6b6a85705 Don't include individual test ulps in libm-test-ulps.
As recently discussed
<https://sourceware.org/ml/libc-alpha/2014-02/msg00670.html>, it
doesn't seem particularly useful for libm-test-ulps files to contain
huge amounts of data on ulps for individual tests; just the global
maximum observed ulps for each function, together with the
verification of exceptions, errno and special results such as
infinities and NaNs for each test, suffices to verify that a
function's behavior on the given test inputs is within the expected
accuracy.  Removing this data reduces source tree churn caused by
updates to these files when libm tests are added, and reduces the
frequency with which testsuite additions actually need libm-test-ulps
changes at all.

Accordingly, this patch removes that data, so that individual tests
get checked against the global bounds for the given function and only
generate an error if those are exceeded.  Tested x86_64 (including
verifying that if an ulps value is artificially reduced, the tests do
indeed fail as they should and "make regen-ulps" generates the
expected changes).

	* math/libm-test.inc (struct ulp_data): Don't refer to ulps for
	individual tests in comment.
	(libm-test-ulps.h): Don't refer to test_ulps in #include comment.
	(prev_max_error): New variable.
	(prev_real_max_error): Likewise.
	(prev_imag_max_error): Likewise.
	(compare_ulp_data): Don't refer to test names in comment.
	(find_test_ulps): Remove function.
	(find_function_ulps): Likewise.
	(find_complex_function_ulps): Likewise.
	(init_max_error): Take function name as argument.  Look up ulps
	for that function.
	(print_ulps): Remove function.
	(print_max_error): Use prev_max_error instead of calling
	find_function_ulps.
	(print_complex_max_error): Use prev_real_max_error and
	prev_imag_max_error instead of calling find_complex_function_ulps.
	(check_float_internal): Take max_ulp parameter instead of calling
	find_test_ulps.  Don't call print_ulps.
	(check_float): Update call to check_float_internal.
	(check_complex): Update calls to check_float_internal.
	(START): Pass argument to init_max_error.
	* math/gen-libm-test.pl (%results): Don't include "kind"
	information.
	(parse_ulps): Don't handle ulps of individual tests.
	(print_ulps_file): Likewise.
	(output_ulps): Likewise.
	* math/README.libm-test: Update.
	* manual/libm-err-tab.pl (parse_ulps): Don't handle ulps of
	individual tests.
	* sysdeps/aarch64/libm-test-ulps: Remove individual test ulps.
	* sysdeps/alpha/fpu/libm-test-ulps: Likewise.
	* sysdeps/arm/libm-test-ulps: Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Likewise.
	* sysdeps/ia64/fpu/libm-test-ulps: Likewise.
	* sysdeps/m68k/coldfire/fpu/libm-test-ulps: Likewise.
	* sysdeps/m68k/m680x0/fpu/libm-test-ulps: Likewise.
	* sysdeps/microblaze/libm-test-ulps: Likewise.
	* sysdeps/mips/mips32/libm-test-ulps: Likewise.
	* sysdeps/mips/mips64/libm-test-ulps: Likewise.
	* sysdeps/powerpc/fpu/libm-test-ulps: Likewise.
	* sysdeps/powerpc/nofpu/libm-test-ulps: Likewise.
	* sysdeps/s390/fpu/libm-test-ulps: Likewise.
	* sysdeps/sh/libm-test-ulps: Likewise.
	* sysdeps/sparc/fpu/libm-test-ulps: Likewise.
	* sysdeps/tile/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

	* sysdeps/hppa/fpu/libm-test-ulps: Remove individual test ulps.
2014-03-05 15:02:38 +00:00
Joseph Myers 45adef3cf2 Fix libm-test.inc:print_complex_max_error handling of some error cases.
When regenerating ulps incrementally with "make regen-ulps", the
resulting diffs should only increase existing ulps, never decrease
them.  This allows successive uses of "make regen-ulps" on different
hardware or with different compiler configurations to accumulate ulps
that are sufficient for tests to pass in a variety of configurations.

However, sometimes changes that decrease ulps are wrongly generated;
thus, when applying
<https://sourceware.org/ml/libc-alpha/2014-02/msg00605.html> I had to
remove such changes manually.  The problem is
print_complex_max_error.  If the ulps for either the real or the
imaginary part of a function are out of range, this function prints
the maximum ulps seen for both parts, which then replace those
previously in libm-test-ulps.  So if the ulps for one part are bigger
than recorded before, but those for the other part are smaller, the
diffs reduce existing ulps.

This patch fixes the logic so that only increased ulps get printed.

Tested x86_64 ("make math/tests", and "make regen-ulps" in a situation
with ulps manually modified so one part would go up and the other
down, to confirm the changes have the intended effect then).

	* math/libm-test.inc (print_complex_max_error): Check separately
	whether real and imaginary errors are within allowed range and
	pass 0 to print_complex_function_ulps instead of value within
	allowed range.
2014-03-04 14:16:25 +00:00
Siddhesh Poyarekar 1cadc85813 Fix sign of input to bsloww1 (BZ #16623)
In 84ba214c, I removed some redundant sign computations and in the
process, I incorrectly got rid of a temporary variable, thus passing
the absolute value of the input to bsloww1.  This caused #16623.

This fix undoes the incorrect change.
2014-02-27 21:12:09 +05:30
Joseph Myers a5f891ac8d Consistently include Makeconfig after defining subdir.
In <https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html> I
noted it was necessary to add includes of Makeconfig early in various
subdirectory makefiles for the tests-special variable settings added
by that patch to be conditional on configuration information.  No-one
commented on the general question there of whether Makeconfig should
always be included immediately after the definition of subdir.

This patch implements that early inclusion of Makeconfig in each
directory (which is a lot easier than consistent placement of includes
of Rules).  Includes are added if needed, or moved up if already
present.  Subdirectory "all:" targets are removed, since Makeconfig
provides one.

There is potential for further cleanups I haven't done.  Rules and
Makerules have code such as

ifneq   "$(findstring env,$(origin headers))" ""
headers :=
endif

to override to empty any value of various variables that came from the
environment.  I think there is a case for Makeconfig setting all the
subdirectory variables (other than subdir) to empty to ensure no
outside value is going to take effect if a subdirectory fails to
define a variable.  (A list of such variables, possibly out of date
and incomplete, is in manual/maint.texi.)  Rules and Makerules would
give errors if Makeconfig hadn't already been included, instead of
including it themselves.  The special code to override values coming
from the environment would then be obsolete and could be removed.

Tested x86_64, including that installed binaries are identical before
and after the patch.

	* argp/Makefile: Include Makeconfig immediately after defining
	subdir.
	* assert/Makefile: Likewise.
	* benchtests/Makefile: Likewise.
	* catgets/Makefile: Likewise.
	* conform/Makefile: Likewise.
	* crypt/Makefile: Likewise.
	* csu/Makefile: Likewise.
	(all): Remove target.
	* ctype/Makefile: Include Makeconfig immediately after defining
	subdir.
	* debug/Makefile: Likewise.
	* dirent/Makefile: Likewise.
	* dlfcn/Makefile: Likewise.
	* gmon/Makefile: Likewise.
	* gnulib/Makefile: Likewise.
	* grp/Makefile: Likewise.
	* gshadow/Makefile: Likewise.
	* hesiod/Makefile: Likewise.
	* hurd/Makefile: Likewise.
	(all): Remove target.
	* iconvdata/Makefile: Include Makeconfig immediately after
	defining subdir.
	* inet/Makefile: Likewise.
	* intl/Makefile: Likewise.
	* io/Makefile: Likewise.
	* libio/Makefile: Likewise.
	(all): Remove target.
	* locale/Makefile: Include Makeconfig immediately after defining
	subdir.
	* login/Makefile: Likewise.
	* mach/Makefile: Likewise.
	(all): Remove target.
	* malloc/Makefile: Include Makeconfig immediately after defining
	subdir.
	(all): Remove target.
	* manual/Makefile: Include Makeconfig immediately after defining
	subdir.
	* math/Makefile: Likewise.
	* misc/Makefile: Likewise.
	* nis/Makefile: Likewise.
	* nss/Makefile: Likewise.
	* po/Makefile: Likewise.
	(all): Remove target.
	* posix/Makefile: Include Makeconfig immediately after defining
	subdir.
	* pwd/Makefile: Likewise.
	* resolv/Makefile: Likewise.
	* resource/Makefile: Likewise.
	* rt/Makefile: Likewise.
	* setjmp/Makefile: Likewise.
	* shadow/Makefile: Likewise.
	* signal/Makefile: Likewise.
	* socket/Makefile: Likewise.
	* soft-fp/Makefile: Likewise.
	* stdio-common/Makefile: Likewise.
	* stdlib/Makefile: Likewise.
	* streams/Makefile: Likewise.
	* string/Makefile: Likewise.
	* sunrpc/Makefile: Likewise.
	(all): Remove target.
	* sysvipc/Makefile: Include Makeconfig immediately after defining
	subdir.
	* termios/Makefile: Likewise.
	* time/Makefile: Likewise.
	* timezone/Makefile: Likewise.
	(all): Remove target.
	* wcsmbs/Makefile: Include Makeconfig immediately after defining
	subdir.
	* wctype/Makefile: Likewise.

libidn/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.

localedata/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.
	(all): Remove target.

nptl/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.

nptl_db/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.
2014-02-26 23:12:03 +00:00
Joseph Myers acd7f096d7 Complete _BSD_SOURCE / _SVID_source followup cleanup.
This patch completes the headers cleanup consequent on removal of
_BSD_SOURCE and _SVID_SOURCE (apart from any subsequent deprecations):

* #endif conditionals that referred to BSD or SVID are updated.

* Redundant __USE_* tests in cases involving __USE_MISC are removed.
  This includes cases such as __USE_MISC || __USE_ISOC99, where
  __USE_MISC is redundant (because __USE_MISC is only ever defined in
  the default / _DEFAULT_SOURCE / _GNU_SOURCE case, when __USE_ISOC99
  is also defined; the same applies to the non-XSI-extended POSIX
  versions), and cases involving __USE_GNU, where __USE_GNU is
  redundant (because if __USE_GNU is defined, so are the other __USE_*
  macros).  There may well be other cases of __USE_FOO || __USE_BAR
  tests that could be simplified because one macro implies the other;
  this patch only addresses cases involving __USE_MISC.

Tested x86_64.

	* bits/fcntl.h [__USE_MISC]: Remove redundant conditionals.
	* bits/sigaction.h [__USE_MISC]: Likewise.
	* bits/waitstatus.h: Update #endif comments.
	* ctype/ctype.h: Likewise.
	* dirent/dirent.h: Likewise.
	[__USE_MISC]: Remove redundant conditionals.
	* grp/grp.h: Update #endif comments.
	[__USE_GNU]: Remove redundant conditionals.
	[__USE_MISC]: Likewise.
	* inet/netinet/in.h [__USE_GNU]: Likewise.
	* io/sys/stat.h [__USE_MISC]: Likewise.
	* libio/bits/stdio-ldbl.h [__USE_MISC]: Likewise.
	* libio/bits/stdio.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* libio/bits/stdio2.h [__USE_MISC]: Likewise.
	* libio/stdio.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* math/bits/math-finite.h [__USE_MISC]: Likewise.
	* math/bits/mathcalls.h [__USE_MISC]: Likewise.
	* math/math.h: Update #else and #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* misc/sys/uio.h: Update #endif comments.
	* posix/bits/unistd.h [__USE_MISC]: Remove redundant conditionals.
	* posix/glob.h [__USE_MISC]: Likewise.
	* posix/sys/types.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* posix/sys/wait.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* posix/unistd.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* pwd/pwd.h [__USE_GNU]: Likewise.
	[__USE_MISC]: Likewise.
	* resolv/netdb.h [__USE_GNU]: Likewise.
	* signal/signal.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* stdlib/stdlib.h: Update #else and #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	[__USE_GNU]: Likewise.
	* string/bits/string2.h [__USE_MISC]: Likewise.
	* string/string.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h [__USE_MISC]:
	Likewise.
	* sysdeps/mach/hurd/bits/fcntl.h [__USE_MISC]: Likewise.
	* sysdeps/mach/hurd/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h: Update #endif
	comments.
	[__USE_MISC]: Remove redundant conditionals.
	* sysdeps/unix/sysv/linux/bits/in.h [__USE_GNU]: Likewise.
	* sysdeps/unix/sysv/linux/bits/sigaction.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/bits/socket.h [__USE_GNU]: Likewise.
	* sysdeps/unix/sysv/linux/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/x86/bits/string.h: Update #endif comments.
	* sysdeps/x86/fpu/bits/mathinline.h [__USE_MISC]: Remove redundant
	conditionals.
	* time/sys/time.h: Update #endif comments.
	* time/time.h: Likewise.
	[__USE_MISC]: Remove redundant conditionals.
2014-02-21 21:45:26 +00:00
Joseph Myers 63689d6165 Move tests of clog10 from libm-test.inc to auto-libm-test-in.
This patch moves tests of clog10 to auto-libm-test-in.  Note that this
means gen-auto-libm-tests will now depend on the recent MPC 1.0.2
release which added a fix for a bug that made gen-auto-libm-tests hang
for clog10.  (It still can't conveniently be used for cacos cacosh
casin casinh catan catanh csin csinh because of extreme slowness of
those functions for special cases in MPC; at least some slow cases of
csin / csinh are fixed in MPC trunk, but not in a release.)

Tested x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add tests of clog10.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (clog10_test_data): Use AUTO_TESTS_c_c.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2014-02-19 14:26:29 +00:00
Joseph Myers c6af2d896c Move tests of fma from libm-test.inc to auto-libm-test-in.
This patch moves tests of fma to auto-libm-test-in, adding the
required support to gen-auto-libm-tests.

Because fma can have exact zero results depending on the rounding
mode, results of fma cannot always be determined from a single value
computed in higher precision with a sticky bit.  Thus, this patch adds
support for recomputing results with the original MPFR/MPC function in
the case where an exact zero is involved.  (This also affects some
results for cpow; when we start testing cpow in all rounding modes, I
think it will be most appropriate to make those tests use
IGNORE_ZERO_INF_SIGN, since ISO C does not attempt to determine signs
of zero results, or special caes in general, for cpow, and I think
signs of zero for cpow are beyond the scope of glibc's accuracy
goals.)

Simply treating the existing test inputs for fma like those for other
functions (i.e., as representing the given value rounded up or down to
any of the supported floating-point formats) increases the size of
auto-libm-test-out by about 16MB (i.e., about half the file is fma
test data).  While rounded versions of tests are perfectly reasonable
test inputs for fma, in this case having them seems excessive, so this
patch allows functions to specify in gen-auto-libm-tests that the
given test inputs are only to be interpreted exactly, not as
corresponding to values rounded up and down.  This reduces the size of
the generated test data for fma to a more reasonable 2MB.

A consequence of this patch is that fma is now tested for correct
presence or absence of "inexact" exceptions, where previously this
wasn't tested because I didn't want to try to add that test coverage
manually to all the existing tests.  As far as I know, the existing
fma implementations are already correct in this regard.

This patch provides the first cases where the gen-auto-libm-tests
support for distinguishing before-rounding/after-rounding underflow
actually produces separate entries in auto-libm-test-out (for
functions without exactly determined results, the affected cases are
all considered underflow-optional, so this only affects functions like
fma with exactly determined results).  I didn't see any signs of
problems with this logic in the output.

Tested x86_64 and x86.

	* math/auto-libm-test-in: Add tests of fma.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (fma_test_data): Use AUTO_TESTS_fff_f.
	(fma_towardzero_test_data): Likewise.
	(fma_downward_test_data): Likewise.
	(fma_upward_test_data): Likewise.
	* math/gen-auto-libm-tests.c (rounding_mode_desc): Add field
	mpc_mode.
	(rounding_modes): Add values for new field.
	(func_calc_method): Add value mpfr_fff_f.
	(func_calc_desc): Add mpfr_fff_f union field.
	(test_function): Add field exact_args.
	(FUNC): Add macro argument EXACT_ARGS.
	(FUNC_mpfr_f_f): Update call to FUNC.
	(FUNC_mpfr_f_f): Likewise.
	(FUNC_mpfr_ff_f): Likewise.
	(FUNC_mpfr_if_f): Likewise.
	(FUNC_mpc_c_f): Likewise.
	(FUNC_mpc_c_c): Likewise.
	(test_functions): Add fma.  Update calls to FUNC.
	(handle_input_arg): Add argument exact_args.
	(add_test): Update call to handle_input_arg.
	(calc_generic_results): Add argument mode.  Handle mpfr_fff_f.
	(output_for_one_input_case): Update call to calc_generic_results.
	Recalculate exact zero results in each rounding mode.
2014-02-18 21:48:51 +00:00
Joseph Myers a4fb786185 Fix gen-auto-libm-tests sticky bit setting for negative results.
gen-auto-libm-tests has a bug in the logic for setting a sticky bit
based on the ternary value from MPFR: it is correct for positive
results, but for negative results mpz_setbit acts as if a two's
complement representation is used, whereas the low bit needs setting
based on the sign-magnitude representation GMP actually uses.  (This
showed up in converting fma tests to use auto-libm-test-in /
gen-auto-libm-tests.)

This patch fixes the problem by negating the mpz_t value to set its
low bit.  There are lots of changes to auto-libm-test-out (mainly 1ulp
fixes to ldbl-128 expected results), but only a few ulps updates are
needed on x86 / x86_64.  In one case, a corrected expectation showed
up a spurious underflow exception where the correct result is slightly
outside the underflowing range.

Tested x86_64 and x86 and ulps updated accordingly.

	* math/gen-auto-libm-tests.c (adjust_real): Ensure integers are
	non-negative before setting low bit.
	* math/auto-libm-test-in: Mark one asin test possibly having
	spurious underflow.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2014-02-18 14:45:41 +00:00
Joseph Myers 498afc54df Combine __USE_BSD and __USE_SVID into __USE_MISC.
This patch cleans up following the obsoletion of _BSD_SOURCE and
_SVID_SOURCE by combining __USE_BSD and __USE_SVID into __USE_MISC.

The only non-mechanical part of this patch is the changes to
features.h; everything else is simple substitution of __USE_MISC for
the old macros.  Thus, this patch leaves obviously redundant
conditionals such as "defined __USE_MISC || defined __USE_MISC", and
does not update #endif comments where they referred to BSD or SVID in
words instead of the literal macro name.  This is intended to
facilitate patch review by separating the less mechanical changes from
these purely mechanical changes into a separate patch.  (I do intend
to integrate all the changes from
<https://sourceware.org/ml/libc-alpha/2013-12/msg00226.html>, which I
believe includes all the trailing comment updates, in subsequent
patches.)

Tested x86_64.

	* include/features.h (__USE_BSD): Remove macro definitions.
	(__USE_SVID): Likewise.
	(_BSD_SOURCE): Likewise.
	(_SVID_SOURCE): Likewise.
	[!defined _BSD_SOURCE && !defined _SVID_SOURCE]: Remove condition
	from definition of _DEFAULT_SOURCE.
	[_BSD_SOURCE || _SVID_SOURCE]: Change condition to
	[_DEFAULT_SOURCE].
	* bits/fcntl.h [__USE_BSD]: Change condition to [__USE_MISC].
	* bits/mman.h [__USE_BSD]: Likewise.
	* bits/termios.h [__USE_BSD]: Likewise.
	* bits/waitstatus.h [__USE_BSD]: Likewise.
	* ctype/ctype.h [__USE_SVID]: Likewise.
	* dirent/dirent.h [__USE_BSD]: Likewise.
	* grp/grp.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* inet/netinet/igmp.h [__USE_BSD]: Likewise.
	* io/fcntl.h [__USE_BSD]: Likewise.
	* io/ftw.h [__USE_BSD]: Likewise.
	* io/sys/stat.h [__USE_BSD]: Likewise.
	* libio/bits/stdio-ldbl.h [__USE_BSD]: Likewise.
	* libio/bits/stdio2.h [__USE_BSD]: Likewise.
	* libio/stdio.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* math/math.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* misc/bits/syslog-ldbl.h [__USE_BSD]: Likewise.
	* misc/bits/syslog.h [__USE_BSD]: Likewise.
	* misc/search.h [__USE_SVID]: Likewise.
	* misc/sys/mman.h [__USE_BSD]: Likewise.
	* misc/sys/syslog.h [__USE_BSD]: Likewise.
	* misc/sys/uio.h [__USE_BSD]: Likewise.
	* posix/bits/unistd.h [__USE_BSD]: Likewise.
	* posix/glob.h [__USE_BSD]: Likewise.
	* posix/regex.h [__USE_BSD]: Likewise.
	* posix/sys/types.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* posix/sys/utsname.h [__USE_SVID]: Likewise.
	* posix/sys/wait.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* posix/unistd.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* pwd/pwd.h [__USE_SVID]: Likewise.
	* resolv/netdb.h [__USE_BSD]: Likewise.
	* setjmp/setjmp.h [__USE_BSD]: Likewise.
	* signal/signal.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* socket/sys/socket.h [__USE_BSD]: Likewise.
	* stdlib/fmtmsg.h [__USE_SVID]: Likewise.
	* stdlib/stdlib.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* string/bits/string2.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* string/bits/string3.h [__USE_BSD]: Likewise.
	* string/endian.h [__USE_BSD]: Likewise.
	* string/string.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* string/strings.h [__USE_BSD]: Likewise.
	* sysdeps/generic/netinet/ip.h [__USE_BSD]: Likewise.
	* sysdeps/gnu/netinet/ip_icmp.h [__USE_BSD]: Likewise.
	* sysdeps/mach/hurd/bits/fcntl.h [__USE_BSD]: Likewise.
	* sysdeps/mach/hurd/bits/stat.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/mman.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/mman-linux.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/bits/sys_errlist.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_ether.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_fddi.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_tr.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/x86/bits/string.h [__USE_BSD]: Likewise.
	* sysvipc/sys/ipc.h [__USE_SVID]: Likewise.
	* termios/termios.h [__USE_BSD]: Likewise.
	* time/sys/time.h [__USE_BSD]: Likewise.
	* time/time.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.

	* sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_BSD]: Change
	condition to [__USE_MISC].
2014-02-12 23:41:01 +00:00
Joseph Myers c941736c92 Remove _BSD_SOURCE and _SVID_SOURCE.
This is a minimal patch to remove _BSD_SOURCE and _SVID_SOURCE from
the documented user API, making them into aliases for _DEFAULT_SOURCE
with a #warning given, but keeping most of the features.h logic using
those macros and all the exising __USE_* conditionals, on the basis
that all the consequent cleanups will go in followup patches.

Tested x86_64.

	* include/features.h: Update comment documenting feature test
	macros.
	[_BSD_SOURCE || _SVID_SOURCE]: Give #warning.  Define
	_DEFAULT_SOURCE.
	* manual/creature.texi (_BSD_SOURCE): Remove documentation.
	(_SVID_SOURCE): Likewise.
	(_DEFAULT_SOURCE): Update description of default features.
	(Feature Test Macros): Don't mention _SVID_SOURCE in conjunction
	with _GNU_SOURCE.
	* manual/filesys.texi (__ftw_func_t): Do not refer to _BSD_SOURCE.
	(S_ISVTX): Likewise.
	* manual/math.texi (Mathematical Constants): Likewise.
	* manual/signal.texi (Interrupted Primitives): Likewise.
	* manual/startup.texi (putenv): Do not refer to _SVID_SOURCE.
	* math/test-matherr.c (_SVID_SOURCE): Do not define.
	* sysvipc/sys/ipc.h [__USE_SVID && !__USE_XOPEN && __GNUC__ >= 2]:
	Don't refer to _SVID_SOURCE in warning text.
2014-02-11 23:40:07 +00:00
Andreas Krebbel 7e6424e343 BZ #16447: Fix ldbl-128 expl implementation.
Extend the range of numbers handled via unsafe mode.
Add expl testcase and regenerate ULPs for s390.
2014-02-11 13:47:47 +01:00
Ondřej Bílka a1ffb40e32 Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
Andreas Schwab 1c0d11bce5 Let gen-libm-test.pl find itself when run outside source directory 2014-01-27 18:43:22 +01:00
Joseph Myers 94d0cea0ad Fix math/test-fpucw-*.c for sysdeps test-fpucw.c overrides.
ARM has an override of the test math/test-fpucw.c, to disable (for
soft-float testing) definitions of hard-float macros in fpu_control.h
that the header normally defines not only when building for
hard-float, but also when building for soft-float with _LIBC defined
so that libc code can dynamically test whether VFP hardware is
present.  (_LIBC is defined when building tests, although ideally it
wouldn't be.)

The override doesn't work for the derived tests test-fpucw-*.c because
they use #include "" instead of <> to include test-fpucw.c, so always
get the math/ version instead of the ARM sysdeps override.  This patch
changes them to use <> so the sysdeps override is effective.
(test-fpucw-ieee-static.c doesn't need a change because it includes
test-fpucw-ieee.c, which isn't itself being overridden, which in turn
includes test-fpucw.c with a #include changed by this patch.)

Tested for ARM (big-endian soft-float, non-VFP hardware).

	* math/test-fpucw-ieee.c: Use <> in #include of test-fpucw.c.
	* math/test-fpucw-static.c: Likewise.
2014-01-16 05:30:52 +00:00
Joseph Myers a5a326f660 Mark more libm tests with xfail-rounding:ldbl-128ibm.
This patch marks more libm tests as expected to fail for ldbl-128ibm
in non-default rounding modes.  Given this, my expm1l fix
<https://sourceware.org/ml/libc-alpha/2014-01/msg00135.html> and my
libgcc fix <http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00157.html>
for spurious overflows, the remaining failures in test-ldouble.out
(for powerpc32 hard float) are small ulps, spurious underflow and
inexact exceptions (the former probably arising from libgcc bugs
though I haven't checked each case; the latter are barely meaningful
for this format anyway when basic arithmetic isn't correctly rounding,
though most of them are probably GCC bug 59412 which doesn't actually
involve long double), missing underflow exceptions from clog, ctan and
ctanh (probably one of the known bugs for another function), and logb
in round-downward mode (bug 887, though it's really a GCC bug that
we're not currently working around).

Tested for powerpc32 hard float.

	* math/auto-libm-test-in: Mark various tests with
	xfail-rounding:ldbl-128ibm.
	* math/auto-libm-test-out: Regenerated.
2014-01-07 22:41:58 +00:00
Joseph Myers 7dd009d865 Mark various libm tests with xfail-rounding:ldbl-128ibm.
This patch marks various libm tests with xfail-rounding:ldbl-128ibm,
where the failures appear to relate to GCC bug 59666 (bad libgcc
handling of directed rounding), so as to allow clean libm-test-ulps
regeneration without needing to edit out large ulps for various
functions manually.

Note that this only deals with the cases problematic for ulps
regeneration.  There are plenty of test failures left that do not
affect ulps regeneration - results that are infinities or NaNs but
should be finite, or vice versa, and missing and spurious exceptions -
which should also be resolved during the release testing period.

Tested for powerpc32 (hard float).

	* math/auto-libm-test-in: Mark various tests with
	xfail-rounding:ldbl-128ibm.
	* math/auto-libm-test-out: Regenerated.
2014-01-03 17:08:10 +00:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Joseph Myers 5b0626b9c5 Fix x86 / x86_64 expl / expl10l wild results in directed rounding modes (bug 16356).
This patch fixes bug 16356, bad results from x86 / x86_64 expl /
exp10l in directed rounding modes, the most serious of the bugs shown
up by my patch expanding libm test coverage.  When I fixed bug 16293,
I thought it was only necessary to set round-to-nearest when using
frndint in expm1 functions, because in other cases the cancellation
error from having the resulting fractional part close to 1 or -1 would
not be significant.  However, in expl and exp10l, the way the final
fractional part gets computed (something more complicated than a
simple subtraction, because more precision is needed than you'd get
that way) can result in a value outside the range [-1, 1] when the
argument to frndint was very close to an integer and was rounded the
"wrong" way because of the rounding mode - and the f2xm1 instruction
has undefined results if its argument is outside [-1, 1], so resulting
in the large errors seen.  So this patch removes the USE_AS_EXPM1L
conditionals on the round-to-nearest settings, so all of expl, expm1l
and exp10l now get round-to-nearest used for frndint (meaning the
final fractional part can at most be slightly above 0.5 in
magnitude).  Associated tests of exp and exp10 are added and testing
of exp10 in directed rounding modes enabled.

Tested x86_64 and x86 and ulps updated accordingly.

	* sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL): Also set
	round-to-nearest for [!USE_AS_EXPM1L].
	* sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL): Likewise.
	* math/auto-libm-test-in: Do not expect cosh tests to fail.  Add
	more tests of exp and exp10.  Expect some exp10 tests to miss
	exceptions or fail in directed rounding modes.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (exp10_tonearest_test_data): New array.
	(exp10_test_tonearest): New function.
	(exp10_towardzero_test_data): New array.
	(exp10_test_towardzero): New function.
	(exp10_downward_test_data): New array.
	(exp10_test_downward): New function.
	(exp10_upward_test_data): New array.
	(exp10_test_upward): New function.
	(main): Call the new functions.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2013-12-21 13:07:16 +00:00
Joseph Myers 31e3a40588 Add more libm-test coverage of [a-c]* real functions.
Various libm functions have inadequate test coverage in libm-test.inc
/ auto-libm-test-in - failing to cover all the usual special cases
(infinities, NaNs, zero, large and small finite values, subnormals) as
well as a reasonable range of ordinary inputs and, where appropriate,
inputs close to the thresholds for underflow and overflow.

This patch improves test coverage for real functions [a-c]* (with the
expectation of adding more coverage for other functions later).

Tested x86_64 and x86 and ulps updated accordingly (and eight glibc
bugs and one C11 DR filed for issues found in the process).

	* math/auto-libm-test-in: Add more tests of acos, acosh, asin,
	asinh, atan, atan2, atanh, cbrt, cos and cosh.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (acosh_test_data): Add more tests.
	(atanh_test_data): Likewise.
	(ceil_test_data): Likewise.
	(copysign_test_data): Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2013-12-20 21:03:39 +00:00
Joseph Myers b7867a3bfb Move tests of cpow from libm-test.inc to auto-libm-test-in.
This patch moves tests of cpow to auto-libm-test-in, adding the
required support to gen-auto-libm-tests.

Tested x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add tests of cpow.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (cpow_test_data): Use AUTO_TESTS_cc_c.
	* * math/gen-auto-libm-tests.c (func_calc_method): Add value
	mpc_cc_c.
	(func_calc_desc): Add mpc_cc_c union field.
	(test_functions): Add cpow.
	(special_fill_2pi): New function.
	(special_real_inputs): Add 2pi.
	(calc_generic_results): Handle mpc_cc_c.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2013-12-20 12:35:10 +00:00
Joseph Myers 7fda568229 Move various TEST_c_c tests from libm-test.inc to auto-libm-test-inc.
This patch moves tests of ccos, ccosh, cexp, clog, csqrt, ctan and
ctanh to auto-libm-test-in, adding the required support to
gen-auto-libm-tests.  Other TEST_c_c functions aren't moved for now
(although the relevant table entries are put in gen-auto-libm-tests
for it to know how to handle them): clog10 because of a known MPC bug
causing it to hang for at least some pure imaginary inputs (fixed in
SVN, but I'd rather not rely on unreleased versions of MPFR or MPC
even if relying on very recent releases); the inverse trig and
hyperbolic functions because of known slowness in special cases; and
csin / csinh because of observed slowness that I need to investigate
and report to the MPC maintainers.  Slowness can be bypassed by moving
to incremental generation (only for new / changed tests) rather than
regenerating the whole of auto-libm-test-out every time, but that
needs implementing.  (This patch takes the time for running
gen-auto-libm-tests from about one second to seven, on my system,
which I think is reasonable.  The slow functions would make it take
several minutes at least, which seems unreasonable.)

Tested x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add tests of ccos, ccosh, cexp, clog,
	csqrt, ctan and ctanh.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (TEST_COND_x86_64): New macro.
	(TEST_COND_x86): Likewise.
	(ccos_test_data): Use AUTO_TESTS_c_c.
	(ccosh_test_data): Likewise.
	(cexp_test_data): Likewise.
	(clog_test_data): Likewise.
	(csqrt_test_data): Likewise.
	(ctan_test_data): Likewise.
	(ctan_tonearest_test_data): Likewise.
	(ctan_towardzero_test_data): Likewise.
	(ctan_downward_test_data): Likewise.
	(ctan_upward_test_data): Likewise.
	(ctanh_test_data): Likewise.
	(ctanh_tonearest_test_data): Likewise.
	(ctanh_towardzero_test_data): Likewise.
	(ctanh_downward_test_data): Likewise.
	(ctanh_upward_test_data): Likewise.
	* math/gen-auto-libm-tests.c (func_calc_method): Add value
	mpc_c_c.
	(func_calc_desc): Add mpc_c_c union field.
	(FUNC_mpc_c_c): New macro.
	(test_functions): Add cacos, cacosh, casin, casinh, catan, catanh,
	ccos, ccosh, cexp, clog, clog10, csin, csinh, csqrt, ctan and
	ctanh.
	(special_fill_min_subnorm_p120): New function.
	(special_real_inputs): Add min_subnorm_p120.
	(calc_generic_results): Handle mpc_c_c.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2013-12-20 12:32:44 +00:00
Joseph Myers 64a17f1add Move tests of cabs and carg from libm-test.inc to auto-libm-test-in.
This patch moves tests of cabs and carg to auto-libm-test-in, adding
the required support to gen-auto-libm-tests.

Tested x86_64 and x86; no ulps updates needed.

	* math/auto-libm-test-in: Add tests of cabs and carg.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (cabs_test_data): Use AUTO_TESTS_c_f.
	(carg_test_data): Likewise.
	* math/gen-auto-libm-tests.c (func_calc_method): Add value
	mpc_c_f.
	(func_calc_desc): Add mpc_c_f union field.
	(test_functions): Add cabs and carg.
	(calc_generic_results): Handle mpc_c_f.
2013-12-19 21:28:30 +00:00
Joseph Myers 6f6fc48226 Move tests of sincos from libm-test.inc to auto-libm-test-in.
This patch moves tests of sincos to auto-libm-test-in, adding the
required support to gen-auto-libm-tests.

Tested x86_64 and x86 and ulps updated accordingly.

(auto-libm-test-out diffs omitted below.)

	* math/auto-libm-test-in: Add tests of sincos.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (sincos_test_data): Use AUTO_TESTS_fFF_11.
	* math/gen-auto-libm-tests.c (func_calc_method): Add value
	mpfr_f_11.
	(func_calc_desc): Add mpfr_f_11 union field.
	(test_functions): Add sincos.
	(calc_generic_results): Handle mpfr_f_11.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2013-12-19 17:21:01 +00:00
Joseph Myers 335ee09231 Disable libm-test test name beautification for M_* constants.
math/gen-libm-test.pl has code to beautify names of various constants,
transforming the source form in libm-test.inc into the version
appearing in test names in libm-test-ulps files.

This has become decreasingly relevant over time for the M_* constants,
first as I changed the test names so only the arguments and not the
expected results appeared in them, then as tests have moved to
auto-libm-test-* so that automatically generated hex float constants
get used instead of M_* in test inputs.

This patch removes the beautification for all M_* constants.  Tested
x86_64 and x86 and ulps updated accordingly.  Even the one case where
this affected the name in the ulps files will disappear once complex
function tests are moved to auto-libm-test-*.

	* math/gen-libm-test.pl (%beautify): Remove M_* constants.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2013-12-19 14:59:22 +00:00
Joseph Myers f88acd39da Fix x86/x86_64 expm1 inaccuracy near 0 in directed rounding modes (bug 16293).
Bug 16293 is inaccuracy of x86/x86_64 versions of expm1, near 0 in
directed rounding modes, that arises from frndint rounding the
exponent to 1 or -1 instead of 0, resulting in large cancellation
error.  This inaccuracy in turn affects other functions such as sinh
that use expm1.  This patch fixes the problem by setting
round-to-nearest mode temporarily around the affected calls to
frndint.  I don't think this is needed for other uses of frndint, such
as in exp itself, as only for expm1 is the cancellation error
significant.

Tested x86_64 and x86 and ulps updated accordingly.

	* sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL) [USE_AS_EXPM1L]: Set
	round-to-nearest mode when using frndint.
	* sysdeps/i386/fpu/s_expm1.S (__expm1): Likewise.
	* sysdeps/i386/fpu/s_expm1f.S (__expm1f): Likewise.
	* sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL) [USE_AS_EXPM1L]:
	Likewise.
	* math/auto-libm-test-in: Add more tests of expm1.  Do not expect
	sinh test to fail.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (TEST_COND_x86_64): Remove macro.
	(TEST_COND_x86): Likewise.
	(expm1_tonearest_test_data): New array.
	(expm1_test_tonearest): New function.
	(expm1_towardzero_test_data): New array.
	(expm1_test_towardzero): New function.
	(expm1_downward_test_data): New array.
	(expm1_test_downward): New function.
	(expm1_upward_test_data): New array.
	(expm1_test_upward): New function.
	(main): Run the new test functions.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2013-12-19 13:36:10 +00:00
Joseph Myers f889953b44 Move tests of jn and yn from libm-test.inc to auto-libm-test-in.
This patch moves tests of jn and yn to auto-libm-test-in, adding the
required support for gen-auto-libm-tests (and adding a missing
assertion there and fixing logic that was broken for functions with
integer arguments).

Tested x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add tests of jn and yn.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (jn_test_data): Use AUTO_TESTS_if_f.
	(yn_test_data): Likewise.
	* math/gen-auto-libm-tests.c (func_calc_method): Add value
	mpfr_if_f.
	(func_calc_desc): Add mpfr_if_f union field.
	(FUNC_mpfr_if_f): New macro.
	(test_functions): Add jn and yn.
	(calc_generic_results): Assert type of second input for
	mpfr_ff_f.  Handle mpfr_if_f.
	(output_for_one_input_case): Disable all checking for arguments
	fitting floating-point types in case of an integer argument.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2013-12-18 17:59:29 +00:00
Joseph Myers 5953eb3ad7 Mark some hypot tests no-test-inline.
As needed on x86.

	* math/auto-libm-test-in: Mark some hypot tests no-test-inline.
	* math/auto-libm-test-out: Regenerated.
2013-12-18 11:46:16 +00:00
Joseph Myers 2dec468fd8 Fix ldbl-128 logl for subnormals (bug 16338).
This patch fixes bug 16338, ldbl-128 logl not handling subnormals
(with consequent inaccuracy for lgammal as well).  The fix is simply
to use __frexpl when determining the exponent, as done already in
log2l and log10l.  Given the lack of testing of small arguments to any
of the log* functions, appropriate tests are added for all of them.

Tested x86_64 and x86 and ulps updated accordingly, and spot tests
also run for mips64 to confirm the ldbl-128 fix.

Note that while this fixes lgammal inaccuracy for small positive
arguments, I suspect that there will still be problems with spurious
underflows in that case.

	* sysdeps/ieee754/ldbl-128/e_logl.c (__ieee754_logl): Use __frexpl
	to determine exponent and adjust argument to have exponent of -1.
	* math/auto-libm-test-in: Add more tests of log, log10, log1p and
	log2.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/x86_64/fpu/libm-test-ulps: Update.
2013-12-18 11:38:27 +00:00
Joseph Myers 6432a5409c Fix dbl-64 hypot spurious underflows (bug 16314). 2013-12-17 13:43:40 +00:00
Joseph Myers c88769dda4 Fix hypot handling of subnormals (bug 16316, bug 16330). 2013-12-17 13:42:13 +00:00
Joseph Myers ff362e5b93 Move tests of atan2, hypot and pow from libm-test.inc to auto-libm-test-in. 2013-12-16 21:18:07 +00:00
Joseph Myers 9f0be4f8b5 Move tests of lgamma from libm-test.inc to auto-libm-test-in. 2013-12-08 23:56:28 +00:00
Joseph Myers e47cc4e0ed Fix tgamma errno setting on underflow (bug 6810). 2013-12-05 14:01:41 +00:00
Joseph Myers bbf37bdc12 Move TEST_f_f tests for [l-y]* functions from libm-test.inc to auto-libm-test-in. 2013-12-05 13:54:50 +00:00
Joseph Myers 699ff83712 Fix Bessel function error handling (bug 6807, bug 15901). 2013-12-04 14:39:37 +00:00
Joseph Myers 749008ff03 Fix exp missing underflows (bug 15268, bug 15425). 2013-12-03 21:49:56 +00:00
Joseph Myers 17dea1887f Fix exp2 errno setting on underflow (bug 16283). 2013-12-03 20:50:51 +00:00
Joseph Myers 34e16df5a1 Fix erfc errno setting on underflow (bug 6786). 2013-12-03 16:25:18 +00:00
Joseph Myers d8e2dbe3e3 Move TEST_f_f tests for [e-j]* functions from libm-test.inc to auto-libm-test-in. 2013-12-03 16:22:49 +00:00
Joseph Myers 176b0c7913 Move TEST_f_f tests for [a-c]* functions from libm-test.inc to auto-libm-test-in. 2013-11-30 22:04:13 +00:00
Joseph Myers 2a77a467b2 Fix exp10 errno setting on underflow (bug 6787). 2013-11-29 16:32:49 +00:00
Joseph Myers ea3bc4e821 Fix x86 sqrt rounding (bug 14032). 2013-11-29 16:31:16 +00:00
Joseph Myers 0712c9d861 Test sqrt in all rounding modes. 2013-11-29 16:28:47 +00:00
Joseph Myers ffb536d0ac Start generating libm tests automatically with MPFR. 2013-11-29 16:27:55 +00:00
Joseph Myers 3c1c46a64a Fix dbl-64 e_sqrt.c for non-default rounding modes (bug 16271). 2013-11-28 16:50:38 +00:00
Joseph Myers 73c1ce4fdb Make powerpc-nofpu floating-point state thread-local (bug 15483). 2013-11-19 13:39:56 +00:00
Chris Metcalf e186536b6f test-fpucw-ieee: Don't use _FPU_IEEE if not defined
Not all architectures define this value, and if they don't,
just let the test run the same as test-fpucw, with __fpu_control
set to _FPU_DEFAULT explicitly.
2013-11-18 18:19:02 -05:00
Joseph Myers ce66581742 Test signs of NaNs in libm-test.inc where appropriate. 2013-11-16 12:48:35 +00:00
Joseph Myers ee1466a953 Add libm-test support for ignored return value, add more lrint / llrint / lround / llround tests. 2013-11-16 12:47:38 +00:00
Joseph Myers 14407b7e60 Replace libm-test.inc TEST_INLINE conditionals with NO_TEST_INLINE flag. 2013-11-16 12:46:52 +00:00
Joseph Myers ca07f1973b Make libm-test.inc check for "inexact" exceptions for NaN argument. 2013-11-16 12:46:03 +00:00
Alan Modra 650ef4bd79 PowerPC floating point little-endian [4 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00084.html

Another batch of ieee854 macros and union replacement.  These four
files also have bugs fixed with this patch.  The fact that the two
doubles in an IBM long double may have different signs means that
negation and absolute value operations can't just twiddle one sign bit
as you can with ieee864 style extended double.  fmodl, remainderl,
erfl and erfcl all had errors of this type.  erfl also returned +1 for
large magnitude negative input where it should return -1.  The hypotl
error is innocuous since the value adjusted twice is only used as a
flag.  The e_hypotl.c tests for large "a" and small "b" are mutually
exclusive because we've already exited when x/y > 2**120.  That allows
some further small simplifications.

	[BZ #15734], [BZ #15735]
	* sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Rewrite
	all uses of ieee875 long double macros and unions.  Simplify test
	for 0.0L.  Correct |x|<|y| and |x|=|y| test.  Use
	ldbl_extract_mantissa value for ix,iy exponents.  Properly
	normalize after ldbl_extract_mantissa, and don't add hidden bit
	already handled.  Don't treat low word of ieee854 mantissa like
	low word of IBM long double and mask off bit when testing for
	zero.
	* sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl): Rewrite
	all uses of ieee875 long double macros and unions.  Simplify tests
	for 0.0L and inf.  Correct double adjustment of k.  Delete dead code
	adjusting ha,hb.  Simplify code setting kld.  Delete two600 and
	two1022, instead use their values.  Recognise that tests for large
	"a" and small "b" are mutually exclusive.  Rename vars.  Comment.
	* sysdeps/ieee754/ldbl-128ibm/e_remainderl.c (__ieee754_remainderl):
	Rewrite all uses of ieee875 long double macros and unions.  Simplify
	test for 0.0L and nan.  Correct negation.
	* sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfl): Rewrite all uses of
	ieee875 long double macros and unions.  Correct output for large
	magnitude x.  Correct absolute value calculation.
	(__erfcl): Likewise.
	* math/libm-test.inc: Add tests for errors discovered in IBM long
	double versions of fmodl, remainderl, erfl and erfcl.
2013-10-04 10:32:48 +09:30
Alan Modra 1b6adf888d PowerPC floating point little-endian [1 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00081.html

This is the first of a series of patches to ban ieee854_long_double
and the ieee854_long_double macros when using IBM long double.  union
ieee854_long_double just isn't correct for IBM long double, especially
when little-endian, and pretending it is OK has allowed a number of
bugs to remain undetected in sysdeps/ieee754/ldbl-128ibm/.

This changes the few places in generic code that use it.

	* stdio-common/printf_size.c (__printf_size): Don't use
	union ieee854_long_double in fpnum union.
	* stdio-common/printf_fphex.c (__printf_fphex): Likewise.  Use
	signbit macro to retrieve sign from long double.
	* stdio-common/printf_fp.c (___printf_fp): Use signbit macro to
	retrieve sign from long double.
	* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Adjust for fpnum change.
	* sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise.
	* sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise.
	* sysdeps/x86_64/fpu/printf_fphex.c: Likewise.
	* math/test-misc.c (main): Don't use union ieee854_long_double.
ports/
	* sysdeps/ia64/fpu/printf_fphex.c: Adjust for fpnum change.
2013-10-04 10:31:41 +09:30
Siddhesh Poyarekar cfa3c8865f New test cases for sin and cos for multiple precision fallback 2013-09-19 16:54:24 +05:30
Maciej W. Rozycki 95e7cf295e Fix static-binary lazy FPU context allocation
Long ago static startup did not parse the auxiliary vector and therefore
could not get at any `AT_FPUCW' tag to check whether upon FPU context
allocation the kernel would use a FPU control word setting different to
that provided by the `__fpu_control' variable.  Static startup therefore
always initialized the FPU control word, forcing immediate FPU context
allocation even for binaries that otherwise never used the FPU.

As from GIT commit f8f900ecb9 static
startup supports parsing the auxiliary vector, so now it can avoid
explicit initialization of the FPU control word, just as can dynamic
startup, in the usual case where the setting written to the FPU control
word would be the same as the kernel uses.  This defers FPU context
allocation until the binary itself actually pokes at the FPU.

Note that the `AT_FPUCW' tag is usually absent from the auxiliary vector
in which case _FPU_DEFAULT is assumed to be the kernel default.
2013-09-09 22:36:57 +01:00
Joseph Myers ffa3cd7f1a Fix lgammaf spurious underflow (bug 15427). 2013-09-03 15:32:54 +00:00
Joseph Myers b7835e3223 Fix spurious jnf underflows (bug 14155). 2013-09-02 14:51:24 +00:00
Thomas Schwinge f1cc4c8654 math: Additional type conversion tests
These have helped me find and fix type conversion issues in QEMU's MIPS
hardware emulation.  While certainly glibc is not the best place for such
tests, they're just an enhancement of tests already present.
2013-08-29 12:21:07 +02:00
Joseph Myers 8fe89494e6 Fix cexp (NaN + i0) (bug 15532). 2013-08-23 19:45:38 +00:00
Joseph Myers acd06bb11f Fix fdim handling of infinities (bug 15797). 2013-08-21 19:56:48 +00:00
Joseph Myers c980f2f4fe Fix cproj handling of (finite, NaN) arguments (bug 15531). 2013-08-20 19:41:15 +00:00
Andreas Schwab ca0a6bc4c5 Fix cbrtl for ldbl-96 2013-08-13 09:45:02 +02:00
David S. Miller f959cfd790 Annotate more cases of math bug 15319.
* math/libm-test.inc (casin_test_data): Annotate more cases of missing
	underflows from atanl/atan2l due to bug 15319.
	(casinh_test_data): Likewise.
2013-07-13 16:57:05 -07:00
Joseph Myers b8c792af85 Allow fesetround failures in math/test-misc.c if ROUNDING_TESTS fails. 2013-06-20 19:11:34 +00:00
Joseph Myers c91e082525 Avoid spurious failures from <fenv.h> fallback functions (bug 15654). 2013-06-20 19:10:44 +00:00
Joseph Myers 1a8463176c Use math-tests.h more in math/test-misc. 2013-06-17 11:48:11 +00:00
Joseph Myers 8fc75e6fb7 Add another fma test. 2013-06-15 19:58:38 +00:00
Joseph Myers 94f2c07669 Make more libm tests condition exceptions tests with math-tests.h. 2013-06-12 12:41:25 +00:00
Joseph Myers f1d73d30df Add exception information to math-tests.h and use it in libm-test.inc. 2013-06-11 15:44:31 +00:00
Joseph Myers 0efa6f8b99 Add rounding mode information to math-tests.h and use it in libm-test.inc. 2013-06-10 12:34:49 +00:00
Joseph Myers 9c84384cc1 Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
Carlos O'Donell 8b0ccb2d7f BZ #15536: Fix ulp for 128-bit IBM long double.
In 128-bit IBM long double the precision of the type
decreases as you approach subnormal numbers, equaling
that of a double for subnormal numbers. Therefore
adjust the computation in ulp to use 2^(MIN_EXP - MANT_DIG)
which is correct for FP_SUBNORMAL for all types.
2013-06-03 14:49:48 -04:00
Joseph Myers fab7ce3f5b Link extra-libs consistently with libc and ld.so. 2013-05-31 16:16:33 +00:00
Joseph Myers 0323d08657 Fix ldbl-96 hypotl of subnormals (bug 15529). 2013-05-24 20:52:55 +00:00
Joseph Myers dd4259b9f7 Test drem and pow10 in libm-test.inc. 2013-05-24 20:33:14 +00:00
Joseph Myers 4f8dfe270b Use same tests for isfinite/finite, lgamma/gamma. 2013-05-24 19:21:22 +00:00
Carlos O'Donell e96e37676f Correctly compute ulp near zero.
The current value used for ulp near zero is wrong,
and this commit fixes it such that ulp(0) is the smallest
subnormal value nearest to zero, which makes the most
sense for testing values near zero. Note that this is not
what Java does; they use the nearest normal value, which
is less accurate than what we want for glibc. Note that
there is no correct implementation of ulp since there
is no strict mathmatical definition that is accepted by
all groups using IEEE 754.

Previously with the large ulp values near zero there
were tests that previously passed, but were in fact
billions of ulp away from the precise answer. With this
commit we now need to disable one of the cpow tests which
is revealed to be inaccurate (bug 14473).

---

2013-05-24  Carlos O'Donell  <carlos@redhat.com>

	* math/libm-test.inc (MAX_EXP): Define.
	(ULPDIFF): Define.
	(ulp): New function.
	(check_float_internal): Use ULPDIFF.
	(cpow_test): Disable failing test.
	(check_ulp): Test ulp() implemetnation.
	(main): Call check_ulp before starting tests.
2013-05-24 14:23:15 -04:00
Joseph Myers e8bdba36c5 Remove libm-test START_DATA and END_DATA. 2013-05-24 13:10:42 +00:00
Joseph Myers b679a606ca Make libm-test START and END into ordinary macros. 2013-05-24 12:22:04 +00:00
Joseph Myers 351fe55087 Don't include function names in test data in generated libm-test.c. 2013-05-22 21:01:44 +00:00
Joseph Myers b50a71810b Don't include expected results in libm-test test names. 2013-05-22 11:49:36 +00:00
Joseph Myers db62a90753 Handle sincos with generic libm-test logic. 2013-05-19 14:45:41 +00:00
Joseph Myers f16cc3eb81 Simplify gen-libm-test.pl handling of tests with extra outputs. 2013-05-19 14:40:40 +00:00
Joseph Myers 2ee094ff75 Don't disable CMPLXL macro for __NO_LONG_DOUBLE_MATH (bug 15488). 2013-05-18 12:12:38 +00:00
Joseph Myers 3779b5b64a Make libm-test look up ulps by name at runtime. 2013-05-18 12:10:59 +00:00
Joseph Myers bb38759d6d Fix remainder exceptions and directed-rounding results (bugs 15480, 15485). 2013-05-17 19:04:08 +00:00
Joseph Myers a00bdcf0e0 Simplify libm-test extra-output initialization. 2013-05-17 19:02:19 +00:00
Joseph Myers de407f79a2 Don't handle ulps for integer tests in libm-test.inc. 2013-05-17 19:01:27 +00:00
Joseph Myers 8269107fe6 Test more cases of "inexact" exceptions in libm-test.inc. 2013-05-17 14:45:50 +00:00
Joseph Myers c58b274f01 Test for errno setting in more pole error cases. 2013-05-16 21:57:25 +00:00
Joseph Myers 0ab349044b Remove ENOSYS tests in libm-test.inc. 2013-05-16 19:09:54 +00:00
Joseph Myers 323e5cb792 Remove libm-test support for TEST_* inside functions. 2013-05-16 19:09:03 +00:00
Joseph Myers 8c75f67421 Convert TEST_extra tests from code to data. 2013-05-16 15:53:40 +00:00
Richard Henderson e6e49e59c1 De-stringify constants in math/atest-exp2.c. 2013-05-16 06:34:01 -07:00
Joseph Myers 105a07dfc0 Support testing "inexact" exceptions in libm-test.inc. 2013-05-16 13:19:38 +00:00
Joseph Myers e9eee333b9 Test for errno setting in more overflow error cases. 2013-05-16 13:18:48 +00:00
Joseph Myers 1c38ff73fd Convert TEST_cc_c tests from code to data. 2013-05-16 13:17:55 +00:00
Joseph Myers 15c7c18dc6 Convert TEST_f_L tests from code to data. 2013-05-16 13:16:56 +00:00
Peter Collingbourne f137ff1383 Remove const attribute on get_log2
This function is not const, as it can modify log2_m and log2_m_inited.
2013-05-15 14:27:53 -07:00
Joseph Myers 3608cb241e Convert TEST_f_l tests from code to data. 2013-05-15 19:48:17 +00:00
Joseph Myers b861c6c4c9 Consistently use TEST_f_L in tests of llrint and llround. 2013-05-15 16:58:41 +00:00
Joseph Myers 7abeee129e Convert TEST_f_b tests from code to data. 2013-05-15 12:04:07 +00:00
Joseph Myers cbe8c4d333 Test for errno setting in more domain error cases. 2013-05-15 10:43:19 +00:00
Joseph Myers 5575c0e5cd Disable libm-test errno testing for TEST_INLINE. 2013-05-15 10:42:18 +00:00
Joseph Myers d369f53178 Convert TEST_ff_i tests from code to data. 2013-05-15 10:41:39 +00:00
Joseph Myers 5e90827081 Fix whitespace in RUN_TEST_LOOP_2_f. 2013-05-14 21:17:19 +00:00
Joseph Myers f71172e551 Correct types of fields in libm-test.inc structures. 2013-05-14 21:00:56 +00:00
Joseph Myers 8cfa635ab8 Convert TEST_ffI_f1 tests from code to data. 2013-05-14 20:36:03 +00:00
Joseph Myers acbd839a07 Convert TEST_f_i tests from code to data. 2013-05-14 19:13:43 +00:00
Joseph Myers e414d745ee Fix function name in scalbln_test call to END. 2013-05-14 19:12:54 +00:00
Joseph Myers d9c2a0fd2c Convert TEST_fI_f1 tests from code to data. 2013-05-14 19:12:10 +00:00
Joseph Myers 9dc9095d56 Convert TEST_fF_f1 tests from code to data. 2013-05-14 14:49:26 +00:00
Joseph Myers 87aa21df6f Convert TEST_f_f1 tests from code to data. 2013-05-14 12:01:19 +00:00
Joseph Myers 68fc074ca0 Convert TEST_fl_f tests from code to data. 2013-05-13 22:38:15 +00:00
Joseph Myers 243216e126 Convert TEST_fi_f tests from code to data. 2013-05-13 19:45:36 +00:00
Joseph Myers 6a1992e268 Convert TEST_c_f tests from code to data. 2013-05-13 18:58:17 +00:00
Joseph Myers 0e400df55d Convert TEST_if_f tests from code to data. 2013-05-13 18:57:35 +00:00
Joseph Myers 6d33265c72 Consistently use TEST_fl_f in tests of scalbln. 2013-05-13 18:56:50 +00:00
Adhemerval Zanella f98ece5fe2 Define decimal constant M_1_DIV_El in libm-test.inc
This patch replaces the 1.0 / M_El by the decimal constant M_1_DIV_El.
2013-05-13 12:08:42 -05:00
Joseph Myers 4f184d30cb Convert TEST_fff_f tests from code to data. 2013-05-12 21:07:58 +00:00
Joseph Myers 081988778f Convert TEST_c_c tests from code to data. 2013-05-12 17:38:26 +00:00
Joseph Myers 601a3a5fd5 Convert TEST_ff_f tests from code to data. 2013-05-12 13:17:09 +00:00
Joseph Myers 8329e4da35 Make fma and nextafter tests use max_value instead of fltmax. 2013-05-11 11:10:31 +00:00
Joseph Myers 74c574788d Convert TEST_f_f tests from code to data. 2013-05-11 11:09:30 +00:00
Joseph Myers 51df539d98 Start converting libm tests from code to data. 2013-05-10 16:45:04 +00:00
Joseph Myers ab2b94613d Fix tgamma errno setting on domain error (bug 6809). 2013-05-10 11:35:11 +00:00
Joseph Myers 0d3e777af2 Use M_SQRT1_2l instead of local M_SQRT_2_2 in libm-test.inc. 2013-05-09 14:33:30 +00:00
Joseph Myers 24f5606614 Use M_PI_34l consistently in libm-test.inc. 2013-05-09 14:13:10 +00:00
Joseph Myers faa7f8119f Use decimal constants in defining M_* in libm-test.inc. 2013-05-09 12:24:44 +00:00
Joseph Myers a0d9f9d745 Factor out initializers for libm-test.inc constants. 2013-05-08 16:10:44 +00:00
Joseph Myers ae08db3ba0 Use correct TEST_* macros for jn, ldexp and yn tests. 2013-05-08 16:09:54 +00:00
Joseph Myers f44bf14a9c Move some libm-test logic for running tests from gen-libm-test.pl to libm-test.inc. 2013-05-08 12:02:22 +00:00
Joseph Myers d8cd06db62 Improve tgamma accuracy (bugs 2546, 2560, 5159, 15426). 2013-05-08 11:58:18 +00:00
Joseph Myers 9ea3513c91 Initialize x in frexp, modf, remqou tests. 2013-05-06 20:23:40 +00:00
Joseph Myers 5bf96de5ef Consistently use TEST_f_f1 in gamma tests. 2013-05-06 20:23:01 +00:00
Adhemerval Zanella 16e616a72f PowerPC: fix hypot/hypof FP exceptions
This patch fixes hypot/hypotf spurious floating-point exceptions
generate by internal operations.
2013-05-06 14:40:17 -05:00
Joseph Myers b7dab1e4d7 Remove unused libm-test expected-failure mechanism. 2013-05-04 16:45:15 +00:00
Joseph Myers a7548d41a7 Use static initializers for constant variables in libm-test.inc. 2013-05-04 13:08:34 +00:00
Joseph Myers c31a5b1e8f Consistently use TEST_f_f1 in lgamma tests. 2013-05-03 19:05:37 +00:00
Joseph Myers d5dc2af390 Don't use IGNORE_ZERO_INF_SIGN in hypot tests. 2013-05-03 19:04:52 +00:00
Joseph Myers 10de07f5fd Fix catan, catanh spurious underflows (bug 15423). 2013-05-01 10:07:00 +00:00
Joseph Myers caf84319c1 Fix catan, catanh inaccuracy from atan2 denominators near 0 (bug 15416). 2013-04-30 11:27:35 +00:00
Joseph Myers f2da779309 Integrate errno testing better in libm-test.inc. 2013-04-29 20:36:48 +00:00
Joseph Myers 4d14f4499d Add missing semicolons to libm-test.inc tests. 2013-04-29 13:48:19 +00:00
Joseph Myers 5b4217d71f Fix catan, catanh spurious overflows (bug 15409). 2013-04-27 14:57:41 +00:00
Joseph Myers 9457fd952c Fix catan, catanh missing underflows (bug 15406). 2013-04-26 19:26:22 +00:00
Joseph Myers f0302940e7 Fix csin, csinh, ccos, ccosh missing underflows (bug 15405). 2013-04-26 19:25:19 +00:00
Carlos O'Donell 418601aa84 math: Use accurate answers for cos and sincos.
Use the most accurate hex literals possible for the answers to the
cos and sincos tests that vary according to the error in the rounding
of PI/2.

---

2013-04-24  Carlos O'Donell  <carlos@redhat.com>

	* math/libm-test.inc (cos_test): Use accurate hex constants.
	(sincost_test): Likewise.
2013-04-24 16:29:33 -04:00
Joseph Myers 5e22180060 Add catan, catanh tests at +/- 1 and +/- i. 2013-04-24 20:14:15 +00:00
Joseph Myers 77f143fdb4 Use suffixed floating-point constants in float and long double catan/catanh. 2013-04-24 18:59:37 +00:00
Joseph Myers 2f38fbfe09 Fix catan, catanh inaccuracy through use of log (bug 15394). 2013-04-24 18:49:13 +00:00
Carlos O'Donell aba5e333d4 libm-test.inc: Fix tests where cos(PI/2) != 0.
The value of PI is never exactly PI in any floating point representation,
and the value of PI/2 is never PI/2. It is wrong to expect cos(M_PI_2l)
to return 0, instead it will return an answer that is  non-zero because
M_PI_2l doesn't round to exactly PI/2 in the type used.

That is to say that the correct answer is to do the following:
* Take PI or PI/2.
* Round to the floating point representation.
* Take the rounded value and compute an infinite precision cos or sin.
* Use the rounded result of the infinite precision cos or sin as the
  answer to the test.

I used printf to do the type rounding, and Wolfram's Alpha to do the
infinite precision cos calculations.

The following changes bring x86-64 and x86 to 1/2 ulp for two tests.
It shows that the x86 cos implementation is quite good, and that
our test are flawed.

Unfortunately given that the rounding errors are type dependent we
need to fix this for each type. No regressions on x86-64 or x86.

---

2013-04-11  Carlos O'Donell  <carlos@redhat.com>

	* math/libm-test.inc (cos_test): Fix PI/2 test.
	(sincos_test): Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Regenerate.
	* sysdeps/i386/fpu/libm-test-ulps: Regenerate.
2013-04-11 08:52:18 -04:00
Siddhesh Poyarekar 01dc6df938 Don't use run-via-rtld-prefix for anything other than tests
run-via-rtld-prefix checks whether the program to be run is a static
test and skips if it is.  This is fine, except that it assumes that
the program to be run is the second $^, which is true only for tests.

This change creates an rtld-prefix, which is simply the dynamic linker
prefix with the necessary arguments and uses that in the non-test
targets.
2013-04-11 09:37:50 +05:30
Carlos O'Donell 085b2d41a4 README.libm-test: Use testrun.sh to run libm test.
Document the use of the convenience testrun.sh script for
running the libm test.

---

2013-04-06  Carlos O'Donell  <carlos@redhat.com>

	* math/README.libm-test (How can I generate "libm-test-ulps"?):
	Use testrun.sh to run libm tests.
2013-04-06 17:13:19 -04:00
Carlos O'Donell 26510bdda1 New Makefile target `regen-ulps'.
The wiki "Regeneration" page has this to say about update ULPs.

"The libm-test-ulps files are semiautomatically updated. To
update an ulps baseline, run each of the failing tests (test-float,
 test-double, etc.) with -u; this will generate a file called ULPs;
concatenate each of those files with the existing libm-test-ulps
file, after removing any entries for particularly huge numbers of
ulps that you do not want to mark as expected. Then run
gen-libm-test.pl -n -u FILE where FILE is the concatenated file
produced in the previous step. This generates a file called
NewUlps which is the new sorted version of libm-test-ulps."

The same information is listed in math/README.libm-test, and is a
lot of manual work that you often want to run over-and-over again
while working on a particular test.

The `regen-ulps' convenience target does this automatically for
developers.

We strictly assume the source tree is readonly and add a
new --output-dir option to libm-test.inc to allow for writing
out ULPs to $(objpfx).

When run the new target does the following:
* Starts with the baseline ULPs file.
* Runs each of the libm math tests with -u.
* Adds new changes seen with -u to the baseline.
* Sorts and prepares the test output with gen-libm-test.pl.
* Leaves math/NewUlps in your build tree to copy to your source
  tree, cleanup, and checkin.

The math test documentation in math/README.libm-test is updated
document the new Makefile target.

---

2013-04-06  Carlos O'Donell  <carlos@redhat.com>

	* Makefile.in (regen-ulps): New target.
	* math/Makefile [ifneq (no,$(PERL)]: Declare regen-ulps with .PHONY.
	[ifneq (no,$(PERL)] (run-regen-ulps): New variable.
	[ifneq (no,$(PERL)] (regen-ulps): New target.
	[ifeq (no,$(PERL)] (regen-ulps): New target.
	* math/libm-test.inc (ulps_file_name): Define.
	(output_dir): New variable.
	(options): Add "output-dir" option.
	(parse_opt): Handle 'o' case.
	(main): If output_dir is non-NULL use it as a prefix
	otherwise use "".
	* math/README.libm-test: Update `How can I generate "libm-test-ulps"?'
2013-04-06 16:22:47 -04:00
Thomas Schwinge a1cbf437a5 [BZ #14686, #15336] Fix standard compliance. Don't use hard-coded qNaN values. 2013-04-05 22:34:52 +02:00
Joseph Myers 05e166c887 Fix missing underflow from cexp (bug 14478). 2013-04-03 16:51:46 +00:00
Joseph Myers 52ce486045 Fix cacosh inaccuracy and spurious exceptions (bug 15327). 2013-04-02 22:54:00 +00:00
Thomas Schwinge 572676160d New <math.h> macro named issignaling to check for a signaling NaN (sNaN).
It is based on draft TS 18661 and currently enabled as a GNU extension.
2013-04-02 13:51:02 +02:00
Joseph Myers ccc8cadf75 Fix casinh inaccuracy for imaginary part < 1.0, real part small (bug 10357). 2013-03-30 13:31:53 +00:00
Joseph Myers 3a7182a14b Fix casinh inaccuracy near i, imaginary part > 1 (bug 15307). 2013-03-27 14:38:44 +00:00
Adhemerval Zanella e42a38dd9d BZ#13889: expl (709.75) wrongly overflows for ldbl-128ibm
The patch increase the high value to check if expl overflows. Current
high mark value is not really correct, the algorithm accepts high values.
It also adds a correct wrapper function to check for overflow and underflow.
2013-03-22 12:39:10 -03:00
Thomas Schwinge bdef0be784 libm-test: Properly wrap blocks consisting of several statements. 2013-03-21 16:07:48 +01:00
Thomas Schwinge 5aa4a1a1fd On 32-bit x86, disable certain tests involving sNaN values.
Follow-up to commit 495ded2c8c.
2013-03-21 16:05:29 +01:00
Joseph Myers 98c48fe5cc Fix Bessel function spurious overflows for ldbl-128 / ldbl-128ibm (bug 15285). 2013-03-21 13:57:21 +00:00
Joseph Myers 0a1b2ae6f6 Fix casinh inaccuracy for argument with imaginary part 1 (bug 15287). 2013-03-21 10:27:10 +00:00
Joseph Myers 6b18bea625 Fix types of constants in k_casinh*.c. 2013-03-19 22:38:25 +00:00
Joseph Myers d2f9799e7c Fix y1l spurious overflows for ldbl-96 (bug 15283). 2013-03-16 17:51:48 +00:00
Joseph Myers 2a185d32e8 Fix spurious underflow exceptions for Bessel functions for ldbl-128 / ldbl-128ibm (bug 14155). 2013-03-16 17:50:28 +00:00
Thomas Schwinge 6cbec759de Move "-sNaN" value into a separate variable. 2013-03-16 13:59:52 +01:00
Thomas Schwinge af00a34d08 * math/libm-test.inc (ldexp_test): Add missing START/END markers. 2013-03-15 19:13:53 +01:00
Thomas Schwinge 495ded2c8c Promote a math test for sNaN handling to the top-level. 2013-03-15 19:12:10 +01:00
Thomas Schwinge 777b0332c0 Use GCC's builtins for generating NaNs. 2013-03-15 19:10:20 +01:00
Thomas Schwinge 64d063b800 Add one test, removed a duplicated one, add a few comments about missing tests. 2013-03-15 19:08:04 +01:00
Thomas Schwinge 67e971f18f Better distinguish between NaN/qNaN/sNaN. 2013-03-15 19:06:02 +01:00
Thomas Schwinge 64487e1264 Enable tests for x86_64, too, which currently are enabled only for x86. 2013-03-15 19:02:18 +01:00
Thomas Schwinge e015e27b90 Fix copy'n'pastos. 2013-03-15 19:00:23 +01:00
Joseph Myers 41c7328e85 Fix spurious underflow exceptions for Bessel functions for double (bug 14155). 2013-03-14 17:47:30 +00:00
Siddhesh Poyarekar e4f223248e Fix some testsuite build warning fixes in libm 2013-02-19 21:20:44 +05:30
Joseph Myers daaa7713e9 Remove bounded-pointers build system support. 2013-02-15 15:07:54 +00:00
Joseph Myers e97ed6ddbe Remove bp-sym.h and BP_SYM uses from C code. 2013-02-14 13:12:02 +00:00
Joseph Myers 8cf28c5ebe Fix casinh spurious underflows away from [-i,i] (bug 15062). 2013-01-31 22:55:29 +00:00
Joseph Myers 728d7b43fc Fix cacos real-part inaccuracy for result real part near 0 (bug 15023). 2013-01-17 20:25:51 +00:00
David S. Miller 32fcb36dbf Add 64-bit VIS3 optimized GMP routines for sparc.
* math/Makefile: Recognize gmp-sysdep_routines.
	* sysdeps/sparc/sparc64/multiarch/Makefile: Add VIS3 optimized GMP routines
	to sysdeps.
	* sysdeps/sparc/sparc64/multiarch/add_n-vis3.S: New file.
	* sysdeps/sparc/sparc64/multiarch/add_n.S: New file.
	* sysdeps/sparc/sparc64/multiarch/addmul_1-vis3.S: New file.
	* sysdeps/sparc/sparc64/multiarch/addmul_1.S: New file.
	* sysdeps/sparc/sparc64/multiarch/mul_1-vis3.S: New file.
	* sysdeps/sparc/sparc64/multiarch/mul_1.S: New file.
	* sysdeps/sparc/sparc64/multiarch/sub_n-vis3.S: New file.
	* sysdeps/sparc/sparc64/multiarch/sub_n.S: New file.
	* sysdeps/sparc/sparc64/multiarch/submul_1-vis3.S: New file.
	* sysdeps/sparc/sparc64/multiarch/submul_1.S: New file.
2013-01-11 23:39:02 -08:00
Joseph Myers 828beb132d Use __extension__ with long long in installed headers. 2013-01-10 20:19:45 +00:00
Andreas Schwab 8790af5f9f Revert "CFLAGS-test-tgmath2.c"
This reverts commit 3167bfc62b.
2013-01-10 10:44:04 +01:00
Andreas Schwab 3167bfc62b CFLAGS-test-tgmath2.c 2013-01-10 09:59:58 +01:00
Joseph Myers a9708fed77 Fix casinh, casin overflow (bug 14996). 2013-01-07 14:59:53 +00:00
Joseph Myers cdc1c96fba Fix casinh, casin inaccuracy from cancellation (bug 14994). 2013-01-04 13:25:17 +00:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Mike Frysinger 9c89fca6e0 math: use existing nonnull attribute define
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-12-30 13:00:13 -05:00
Joseph Myers 1bead169c3 Fix powl inaccuracy for x86_64 and x86 (bug 13881). 2012-11-28 13:40:54 +00:00
Joseph Myers 7184dcdf26 Disable some fma tests for ldbl-128ibm. 2012-11-22 19:57:58 +00:00
Joseph Myers 0a42601f27 Fix ldbl-128ibm atanl spurious underflows (bug 14871). 2012-11-22 19:56:47 +00:00
Joseph Myers 1468ded38e Fix ldbl-128ibm hypotl internal underflows (bug 14869). 2012-11-22 14:58:41 +00:00
Joseph Myers 8e27e3cc45 Fix ldbl-128ibm hypotl inaccuracy for arguments with large ratio (bug 14868). 2012-11-22 14:57:22 +00:00
Joseph Myers c9c0279bcb Mark some clog / clog10 underflows as expected for IBM long double. 2012-11-22 14:56:14 +00:00
David S. Miller 6d33cc9d9b Fix spurious underflows in ldbl-128 atan implementation.
With help from Joseph Myers.
	* sysdeps/ieee754/ldbl-128/s_atanl.c (__atanl): Handle tiny and
	very large arguments properly.
	* math/libm-test.inc (atan_test): New tests.
	(atan2_test): New tests.
	* sysdeps/sparc/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Update.
2012-11-19 15:31:24 -08:00
David S. Miller 05b227bdae Correct tinyness handling in long-double and float y0/y1.
With help from Joseph Myers.
	* sysdeps/ieee754/flt-32/e_j0f.c (__ieee754_y0f): Adjust tinyness
	cutoff to 2**-13.
	* sysdeps/ieee754/flt-32/e_j1f.c (__ieee754_y1f): Adjust tinyness
	cutoff to 2**-25.
	* sysdeps/ieee754/ldbl-128/e_j0l.c (U0): New constant.
	( __ieee754_y0l): Avoid arithmetic underflow when 'x' is very
	small.
	* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_y1l): Likewise.
	* math/libm-test.inc (y0_test): New tests.
	(y1_test): New tests.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Update.
	* sysdeps/sparc/fpu/libm-test-ulps: Update.
2012-11-18 12:33:53 -08:00
Marcus Shawcroft 2fd8978571 Fix buffer overflow in libm-test.inc check_complex() 2012-11-15 18:02:03 +00:00
Joseph Myers 60e235ee2a Fix spurious underflows from pow with results close to 1 (bug 14811). 2012-11-07 13:03:31 +00:00
Joseph Myers 82477c28f4 Fix fma underflows with small x * y (bug 14793). 2012-11-06 14:12:54 +00:00
Joseph Myers a0c2940d67 Fix fma overflow results outside round-to-nearest mode (bug 14797). 2012-11-04 19:26:02 +00:00
Thomas Schwinge b830319d49 [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
Joseph Myers 5b5b04d628 Make fma use of Dekker and Knuth algorithms use round-to-nearest (bug 14796). 2012-11-03 19:48:53 +00:00
Joseph Myers 0155d5b26e Make math.h FP_* macros usable in #if (bug 3439). 2012-11-02 22:11:21 +00:00
Joseph Myers 473611b22d Fix fma (a, b, c) for small a * b (bugs 14784, 14785). 2012-11-01 16:47:26 +00:00
Joseph Myers 16a0e2ec87 Fix ldbl-128ibm atan2l for x near 1. 2012-10-31 20:44:59 +00:00
Joseph Myers ef82f4da79 Fix fma underflow exceptions in after-rounding edge cases. 2012-10-31 13:01:17 +00:00
Joseph Myers 8627a2329c Fix fma missing underflows and bad results for some subnormal results (bugs 14152, 14783). 2012-10-30 13:54:50 +00:00
Markus Trippelsdorf d077f65fc8 Comment on slow compilation of math/test-tgmath2.c
The math/test-tgmath2.c testcase uses very long lines
(>3 million), so it may take a while to compile it.

See: http://llvm.org/bugs/show_bug.cgi?id=14106 and
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54402
2012-10-18 16:03:49 -04:00
Joseph Myers f9b9d9c945 Don't call feclearexcept in gamma function tests. 2012-10-17 23:42:32 +00:00
Joseph Myers 0e8e0c1c93 Make libm-test.inc test comparison macros. 2012-10-09 23:34:12 +00:00
Joseph Myers ef1bb3618c Improve libm test coverage of classification macros / functions. 2012-10-08 22:22:23 +00:00
Joseph Myers 28234b077e Improve libm-test.inc comment. 2012-10-05 17:06:23 +00:00
Joseph Myers bec749fda1 Fix sign of inexact zero return from fma (bug 14645). 2012-10-01 08:30:06 +00:00
Joseph Myers 8ec5b01346 Fix sign of exact zero return from fma (bug 14638). 2012-09-29 18:31:54 +00:00
Joseph Myers d032e0d29b Fix inaccuracy of clog, clog10 near |z| = 1 (bug 13629). 2012-09-25 19:43:49 +00:00
Liubov Dmitrieva 6d3bf19931 Fix wrong ussage of sincos for subnormal arguments 2012-09-25 20:41:17 +02:00
Liubov Dmitrieva 4ffffbd272 Add optimized sinf and cosf routines for x86 and x86-64
* sysdeps/i386/i686/fpu/multiarch/Makefile (sysdep_routines):
	Add s_sinf-sse2, s_conf-sse2.

	* sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S: New file.
	* sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S: New file.
	* sysdeps/i386/i686/fpu/multiarch/s_sinf.c: New file.
	* sysdeps/i386/i686/fpu/multiarch/s_cosf.c: New file.

	* sysdeps/ieee754/flt-32/s_sinf.c (SINF, SINF_FUNC): Add macros
	for using routine as __sinf_ia32.
	Use macro for function declaration and weak_alias.
	* sysdeps/ieee754/flt-32/s_cosf.c (COSF, COSF_FUNC): Add macros
	for using routine as __cosf_ia32.
	Use macro for function declaration and weak_alias.

	* sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.S: Fix Copyright.
	* sysdeps/i386/i686/fpu/multiarch/e_expf.c: Fix Copyright.

	* sysdeps/x86_64/fpu/s_sinf.S: New file.
	* sysdeps/x86_64/fpu/s_cosf.S: New file.
	* sysdeps/x86_64/fpu/libm-test-ulps: Update.

	* math/libm-test.inc (cos_test): Add more test cases.
	(sin_test): Likewise.
	(sincos_test): Likewise.
2012-09-03 15:32:13 +02:00
Joseph Myers d0419dbfbd Improve clog, clog10 handling of values with real or imaginary part slightly above 1 (bug 13629). 2012-07-31 14:21:19 +00:00
Joseph Myers da865e95bc Improve clog, clog10 handling of values with real or imaginary part 1 (bug 13629). 2012-07-26 11:31:35 +00:00
Marek Polacek 354691b7b5 Set up errno properly for yn. 2012-07-25 12:59:36 +02:00
Thomas Schwinge c23c33b01e Add missing includes.
Follow-up to commits 38de94a5ef,
76da726532.
2012-07-22 22:25:14 +02:00
Marek Polacek 541428fecf Fix ynl return value with LDBL_MIN. 2012-07-12 16:34:47 +02:00
Joseph Myers 638a572eb0 Fix clog, clog10 spurious underflow exceptions (bug 14337). 2012-07-09 11:06:34 +00:00
Joseph Myers 9ad63c23ea Fix tanf underflow close to pi/4 (bug 14154). 2012-07-06 21:19:38 +00:00
Joseph Myers f17ac40d7c Fix expm1 spurious underflow exceptions (bug 6778). 2012-07-06 11:17:41 +00:00
Joseph Myers cdfe2c5eb3 Fix csqrt underflow (bugs 14157, 14331). 2012-07-05 11:02:13 +00:00
Joseph Myers ca61cf32d9 Fix ctan, ctanh of subnormals in round-upwards mode (bug 14328). 2012-07-04 09:55:26 +00:00
Joseph Myers 7a845b2c23 Fix float range reduction problems (bug 14283). 2012-07-03 17:11:41 +00:00
Joseph Myers e2283f38fe Add cosh tests for bug 14273. 2012-07-03 17:06:55 +00:00
Joseph Myers 10285c2113 Fix pow (0.0, -Inf) (bug 14241). 2012-06-15 11:27:51 +00:00
Joseph Myers 75fa192131 Allow more spurious underflow exceptions from csqrt and Bessel functions. 2012-06-14 14:35:24 +00:00
Joseph Myers c5bfe3d5ba Fix fmod for subnormals (bug 14048). 2012-06-01 19:05:46 +00:00
Joseph Myers 2d10d547c1 Use more decimal places for long double constants in math.h. 2012-05-31 21:25:48 +00:00
Marek Polacek d81dcb3569 Fix fma test for underflow. 2012-05-26 13:49:49 +02:00
Joseph Myers b65504975c Fix acosf underflow (bug 14153). 2012-05-25 11:07:07 +00:00
Joseph Myers 7a25eb06bf Add tests for underflow exception bugs 10846, 14036. 2012-05-24 15:36:54 +00:00
Joseph Myers 795405f956 Don't include exceptions in libm-test-ulps test names. 2012-05-24 12:14:03 +00:00
Joseph Myers 80bad0ccae Test underflow exceptions in libm-test.inc. 2012-05-24 11:26:36 +00:00
Joseph Myers e0b16cc25c Fix ccos, csin, ccosh, csinh overflows (bug 14123). 2012-05-19 15:35:29 +00:00
Chris Metcalf 0af797def3 math: support platforms with limited FP rounding or exception support
For some tests, just claim that fetestexcept() always returns true,
so the rest of the test can be compiled.

For libm-test, provide known bogus values for unsupported rounding
modes, so fesetround() will return failure.

Elsewhere, just add some #ifdefs to avoid code that uses particular
FP exceptions if the exceptions aren't supported.
2012-05-17 08:50:41 -04:00
Roland McGrath 38de94a5ef Add a missing #include. 2012-05-10 15:57:24 -07:00
Adhemerval Zanella 89c9aa491a Fix for logb/logbf/logbl (bugs 13954/13955/13956)
POSIX 2008 states that if the input for 'logb[f|l]' is a subnormal number
it should be treated as if it were normalized.  This means the
implementation should calculate the log2 of the mantissa and add it to the
subnormal exponent (-126 for float and -1022 for double and IBM long
double).  This patch takes care of that.
2012-05-10 15:11:55 -05:00
Joseph Myers 495fd99f3a Fix x86/x86_64 expm1l inaccuracy and exceptions (bugs 13885, 13923). 2012-05-07 19:13:08 +00:00