Commit Graph

312 Commits

Author SHA1 Message Date
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 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 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
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
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 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 af00a34d08 * math/libm-test.inc (ldexp_test): Add missing START/END markers. 2013-03-15 19:13:53 +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
Joseph Myers 41c7328e85 Fix spurious underflow exceptions for Bessel functions for double (bug 14155). 2013-03-14 17:47:30 +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
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
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
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 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
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 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
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