glibc/math
Joseph Myers 3bfee8beb8 Make bits/math-finite.h conditions match other headers (bug 19205).
bits/math-finite.h declares -ffinite-math-only variants of various
functions under conditions not matching those under which the normal
versions are declared.

* math.h only ever includes bits/mathcalls.h to declare float and long
  double functions if __USE_ISOC99, but bits/math-finite.h declares
  some float functions regardless (long double ones are conditioned on
  __MATH_DECLARE_LDOUBLE).  (For C90 functions this isn't a
  conformance bug because C90 reserves the float and long double
  names, but is still contrary to good glibc practice.  For some other
  functions in older XSI standards it *is* a conformance bug.)

* Some functions are defined as inlines using lgamma_r functions under
  conditions where those lgamma_r functions are not themselves
  declared.

* hypot is declared under __USE_XOPEN || __USE_ISOC99 in
  bits/mathcalls.h, __USE_ISOC99 only in bits/math-finite.h.

* float and long double versions of Bessel functions should be limited
  to __USE_MISC (as in bug 18977).

* gamma should not be declared for __USE_XOPEN2K (as in bug 18967).

* remainder should be restricted to __USE_XOPEN_EXTENDED ||
  __USE_ISOC99, not unconditional.

* scalb should not be declared for __USE_XOPEN2K8, and scalbf and
  scalbl are non-POSIX (as in bug 18967).

This patch fixes all these issues (it doesn't seem worth splitting
them into separate patches or bugs).  I put __USE_ISOC99 conditionals,
where needed, around both float and long double declarations, even
though formally redundant around the long double declarations because
__MATH_DECLARE_LDOUBLE isn't defined without __USE_ISOC99; it seemed
clearer that way.  The missing declarations of lgamma_r functions are
dealt with by directly using declarations of __lgamma*_r_finite, in
the implementation namespace, rather than having the inlines rely on
asm redirection of lgamma*_r.

After this patch, there are some apparently redundant nested
__USE_ISOC99 conditionals in lgamma / gamma definitions.  These
actually reflect a separate bug (the correct condition for the lgamma
inline functions to set signgam is __USE_MISC || __USE_XOPEN, the
condition under which signgam is declared, rather than disabling
setting it if __USE_ISOC99, which includes XSI POSIX versions for
which signgam *should* be set).  They'll be fixed as part of a fix for
that bug, which will also add tests for these inlines.  I've put a
note about more general conform/ test coverage for -ffinite-math-only
on
<https://sourceware.org/glibc/wiki/Development_Todo/Master#conformtest_improvements>,
alongside other options for which this is also relevant (some of which
have also had such bugs in the past relating to mismatched
conditionals).

I also intend to enable the main libm-test.inc tests for the
math-finite.h functions, but some other bugs in __*_finite need fixing
first.

	[BZ #19205]
	* math/bits/math-finite.h (acosf): Condition declaration on
	[__USE_ISOC99].
	(acosl): Likewise.
	(acoshf): Likewise.
	(acoshl): Likewise.
	(asinf): Likewise.
	(asinl): Likewise.
	(atan2f): Likewise.
	(atan2l): Likewise.
	(atanhf): Likewise.
	(atanhl): Likewise.
	(coshf): Likewise.
	(coshl): Likewise.
	(expf): Likewise.
	(expl): Likewise.
	(fmodf): Likewise.
	(fmodl): Likewise.
	(hypot): Change condition to [__USE_XOPEN || __USE_ISOC99].
	(j0f): Change condition to [__USE_MISC && __USE_ISOC99].
	(j0l): Likewise.
	(y0f): Likewise.
	(y0l): Likewise.
	(j1f): Likewise.
	(j1l): Likewise.
	(y1f): Likewise.
	(y1l): Likewise.
	(jnf): Likewise.
	(jnl): Likewise.
	(ynf): Likewise.
	(ynl): Likewise.
	(lgammaf_r): Condition declaration on [__USE_ISOC99].
	(lgammal_r): Likewise.
	(__lgamma_r_finite): New declaration.
	(__lgammaf_r_finite): Likewise.
	(__lgammal_r_finite): Likewise.
	(lgamma): Use __lgamma_r_finite.
	(lgammaf): Condition definition on [__USE_ISOC99].  Use
	__lgammaf_r_finite.
	(lgammal): Condition definition on [__USE_ISOC99].  Use
	__lgammal_r_finite.
	(gamma): Do not define for [!__USE_MISC && __USE_XOPEN2K].  Use
	__lgamma_r_finite.
	(gammaf): Condition definition on [__USE_ISOC99].  Use
	__lgammaf_r_finite.
	(gammal): Condition definition on [__USE_ISOC99].  Use
	__lgammal_r_finite.
	(logf): Condition declaration on [__USE_ISOC99].
	(logl): Likewise.
	(log10f): Likewise.
	(log10l): Likewise.
	(ldexpf): Likewise.
	(ldexpl): Likewise.
	(powf): Likewise.
	(powl): Likewise.
	(remainder): Condition declaration on [__USE_XOPEN_EXTENDED ||
	__USE_ISOC99].
	(remainderf): Condition declaration on [__USE_ISOC99].
	(remainderl): Likewise.
	(scalb): Do not declare for [!__USE_MISC && __USE_XOPEN2K8].
	(scalbf): Change condition to [__USE_MISC && __USE_ISOC99].
	(scalbl): Likewise.
	(sinhf): Condition declaration on [__USE_ISOC99].
	(sinhl): Likewise.
	(sqrtf): Likewise.
	(sqrtl): Likewise.
2015-11-05 00:48:57 +00:00
..
bits Make bits/math-finite.h conditions match other headers (bug 19205). 2015-11-05 00:48:57 +00:00
machine
atest-exp2.c Adjust timeouts for some tests, to accommodate slow processors, 2015-02-22 01:05:02 -08:00
atest-exp.c Adjust timeouts for some tests, to accommodate slow processors, 2015-02-22 01:05:02 -08:00
atest-sincos.c Adjust timeouts for some tests, to accommodate slow processors, 2015-02-22 01:05:02 -08:00
auto-libm-test-in Add more libm tests (scalb*, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, y0, y1, yn, significand). 2015-11-04 00:45:23 +00:00
auto-libm-test-out Add more libm tests (scalb*, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, y0, y1, yn, significand). 2015-11-04 00:45:23 +00:00
basic-test.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
bug-nextafter.c
bug-nexttoward.c
bug-tgmath1.c
cabs.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
cabsf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
cabsl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
carg.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
cargf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
cargl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
cimag.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
cimagf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
cimagl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
complex.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
conj.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
conjf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
conjl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
creal.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
crealf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
creall.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
divtc3.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
e_acoshl.c
e_acosl.c
e_asinl.c
e_atan2l.c
e_atanhl.c
e_coshl.c
e_exp2l.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
e_exp10.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
e_exp10f.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
e_exp10l.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
e_expl.c
e_fmodl.c
e_gammal_r.c
e_hypotl.c
e_j0l.c
e_j1l.c
e_jnl.c
e_lgammal_r.c
e_log2l.c
e_log10l.c
e_logl.c
e_powl.c
e_rem_pio2l.c
e_scalb.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
e_scalbf.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
e_scalbl.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
e_sinhl.c
e_sqrtl.c
fclrexcpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fedisblxcpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
feenablxcpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fegetenv.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fegetexcept.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fegetround.c Fix libm fegetround namespace (bug 17748). 2015-01-02 20:44:42 +00:00
feholdexcpt.c Fix libm feholdexcept namespace (bug 17748). 2015-01-05 23:06:14 +00:00
fenv.h Mark fegetround pure (bug 16296). 2015-09-15 20:36:50 +00:00
fesetenv.c Fix libm fesetenv namespace (bug 17748). 2015-01-06 23:36:20 +00:00
fesetround.c Fix libm fesetround namespace (bug 17748). 2015-01-07 00:41:23 +00:00
feupdateenv.c Fix libm feupdateenv namespace (bug 17748). 2015-01-07 19:01:20 +00:00
fgetexcptflg.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fpu_control.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fraiseexcpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fsetexcptflg.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ftestexcept.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
gen-auto-libm-tests.c Use -std=gnu11 instead of -std=gnu99. 2015-10-27 21:47:22 +00:00
gen-libm-have-vector-test.sh Improve tgamma accuracy (bug 18613). 2015-06-29 23:29:35 +00:00
gen-libm-test.pl Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ieee-math.c
k_casinh.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
k_casinhf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
k_casinhl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
k_cosl.c
k_rem_pio2l.c
k_sincosl.c
k_sinl.c
k_tanl.c
libm-test.inc Refactor libm-test inline tests disabling. 2015-11-04 21:30:26 +00:00
Makefile Make drem an alias of remainder (bug 16171). 2015-10-29 22:29:21 +00:00
math.h Add inlining of the C99 math functions isinf/isnan/signbit/isfinite/isnormal/fpclassify using GCC 2015-09-18 16:34:45 +01:00
multc3.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
README.libm-test Clarify math/README.libm-test. Add "How to read the test output." 2015-01-28 21:07:01 -07:00
s_asinhl.c
s_atanl.c
s_cacos.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_cacosf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_cacosh.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_cacoshf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_cacoshl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_cacosl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_casin.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
s_casinf.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
s_casinh.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_casinhf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_casinhl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_casinl.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
s_catan.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_catanf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_catanh.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_catanhf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_catanhl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_catanl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_cbrtl.c
s_ccos.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_ccosf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_ccosh.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_ccoshf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_ccoshl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_ccosl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_cexp.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_cexpf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_cexpl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_clog10.c Fix clog, clog10 inaccuracy (bug 19016). 2015-09-28 22:11:22 +00:00
s_clog10f.c Fix clog, clog10 inaccuracy (bug 19016). 2015-09-28 22:11:22 +00:00
s_clog10l.c Fix clog, clog10 inaccuracy (bug 19016). 2015-09-28 22:11:22 +00:00
s_clog.c Fix clog, clog10 inaccuracy (bug 19016). 2015-09-28 22:11:22 +00:00
s_clogf.c Fix clog, clog10 inaccuracy (bug 19016). 2015-09-28 22:11:22 +00:00
s_clogl.c Fix clog, clog10 inaccuracy (bug 19016). 2015-09-28 22:11:22 +00:00
s_cpow.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_cpowf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_cpowl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_cproj.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
s_cprojf.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
s_cprojl.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
s_csin.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_csinf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_csinh.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_csinhf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_csinhl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_csinl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_csqrt.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_csqrtf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_csqrtl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_ctan.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_ctanf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_ctanh.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_ctanhf.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_ctanhl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_ctanl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_erfl.c
s_expm1l.c
s_fdim.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fdimf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fdiml.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fma.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fmaf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fmal.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fmax.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fmaxf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fmaxl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fmin.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fminf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_fminl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_ldexp.c Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_ldexpf.c Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_ldexpl.c Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_log1pl.c Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
s_nan.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_nanf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_nanl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_nextafter.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_nexttowardf.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_nexttowardl.c
s_significand.c
s_significandf.c
s_significandl.c
s_tanhl.c
setfpucw.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
t_sincosl.c
test-double-vlen2.h Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-double-vlen4.h Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-double-vlen8.h Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-double.c Refactor libm-test inline tests disabling. 2015-11-04 21:30:26 +00:00
test-double.h Use C11 CMPLX* macros in libm tests. 2015-10-28 21:57:10 +00:00
test-fenv-clear-main.c Fix i386/x86_64 fesetenv SSE exception clearing (bug 19181). 2015-10-28 18:50:20 +00:00
test-fenv-clear.c Fix i386/x86_64 fesetenv SSE exception clearing (bug 19181). 2015-10-28 18:50:20 +00:00
test-fenv-preserve.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
test-fenv-return.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
test-fenv-tls.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
test-fenv.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
test-fenvinline.c math/test-fenvinline: avoid compiler warning 2015-07-10 16:11:40 -04:00
test-float-vlen4.h Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-float-vlen8.h Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-float-vlen16.h Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-float.c Refactor libm-test inline tests disabling. 2015-11-04 21:30:26 +00:00
test-float.h Use C11 CMPLX* macros in libm tests. 2015-10-28 21:57:10 +00:00
test-fpucw-ieee-static.c
test-fpucw-ieee.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
test-fpucw-static.c
test-fpucw.c Modify several tests to use test-skeleton.c 2015-07-15 15:10:23 +05:30
test-idouble.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-ifloat.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-ildoubl.c Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-ldouble.c Refactor libm-test inline tests disabling. 2015-11-04 21:30:26 +00:00
test-ldouble.h Use C11 CMPLX* macros in libm tests. 2015-10-28 21:57:10 +00:00
test-math-errno.h Refactor libm-test inline tests disabling. 2015-11-04 21:30:26 +00:00
test-math-inline.h Refactor libm-test inline tests disabling. 2015-11-04 21:30:26 +00:00
test-math-no-inline.h Refactor libm-test inline tests disabling. 2015-11-04 21:30:26 +00:00
test-math-scalar.h Refactor libm tests. 2015-06-24 23:27:18 +00:00
test-math-vector.h Refactor libm-test inline tests disabling. 2015-11-04 21:30:26 +00:00
test-matherr.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
test-misc.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
test-nearbyint-except.c Fix i386 / x86_64 nearbyint exception clearing (bug 15491). 2015-10-22 23:14:55 +00:00
test-powl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
test-snan.c Clean up math/test-snan. 2015-02-10 13:55:29 -08:00
test-tgmath2.c Modify several tests to use test-skeleton.c 2015-07-15 15:10:23 +05:30
test-tgmath-int.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
test-tgmath-ret.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
test-tgmath.c Modify several tests to use test-skeleton.c 2015-07-15 15:10:23 +05:30
tgmath.h Fix math.h, tgmath.h XSI POSIX namespace (gamma, isnan, scalb) (bug 18967). 2015-09-15 22:12:40 +00:00
tst-CMPLX2.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-CMPLX.c
tst-definitions.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Versions Really fix sysdeps/i386/fpu/s_scalbn.S build 2015-09-19 14:23:16 +02:00
w_acos.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_acosf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_acosh.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_acoshf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_acoshl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_acosl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_asin.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_asinf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_asinl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_atan2.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_atan2f.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_atan2l.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_atanh.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_atanhf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_atanhl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_cosh.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_coshf.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_coshl.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_exp2.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_exp2f.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_exp2l.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_exp10.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_exp10f.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_exp10l.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_expl.c
w_fmod.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
w_fmodf.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
w_fmodl.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
w_hypot.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_hypotf.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_hypotl.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_ilogb.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_ilogbf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_ilogbl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_j0.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_j0f.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_j0l.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_j1.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_j1f.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_j1l.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_jn.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_jnf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_jnl.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_lgamma_r.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_lgamma.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_lgammaf_r.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_lgammaf.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_lgammal_r.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_lgammal.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_log1p.c Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
w_log1pf.c Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
w_log1pl.c Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
w_log2.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_log2f.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_log2l.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_log10.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_log10f.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_log10l.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_log.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_logf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_logl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_pow.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_powf.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_powl.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_remainder.c Make drem an alias of remainder (bug 16171). 2015-10-29 22:29:21 +00:00
w_remainderf.c Make drem an alias of remainder (bug 16171). 2015-10-29 22:29:21 +00:00
w_remainderl.c Make drem an alias of remainder (bug 16171). 2015-10-29 22:29:21 +00:00
w_scalb.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
w_scalbf.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
w_scalbl.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
w_scalbln.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_scalblnf.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_scalblnl.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_sinh.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_sinhf.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_sinhl.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
w_sqrt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_sqrtf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_sqrtl.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_tgamma.c Cleanup a few cases where isinf is used to get the signbit to improve the readability and maintainability and allow inlining. 2015-09-18 21:19:48 +01:00
w_tgammaf.c Cleanup a few cases where isinf is used to get the signbit to improve the readability and maintainability and allow inlining. 2015-09-18 21:19:48 +01:00
w_tgammal.c Cleanup a few cases where isinf is used to get the signbit to improve the readability and maintainability and allow inlining. 2015-09-18 21:19:48 +01:00

README for libm-test math test suite
====================================

The libm-test math test suite tests a number of function points of
math functions in the GNU C library.  The following sections contain a
brief overview.  Please note that the test drivers and the Perl script
"gen-libm-test.pl" have some options.  A full list of options is
available with --help (for the test drivers) and -h for
"gen-libm-test.pl".


What is tested?
===============
The tests just evaluate the functions at specified points and compare
the results with precomputed values and the requirements of the ISO
C99 standard.

Besides testing the special values mandated by IEEE 754 (infinities,
NaNs and minus zero), some more or less random values are tested.

Files that are part of libm-test
================================

The main file is "libm-test.inc".  It is independent of the target
platform and the specific real floating type and format and contains
placeholder test "templates" for math functions defined in libm.
The file, along with a generated file named "auto-libm-test-out",
is preprocessed by the Perl script "gen-libm-test.pl" to expand
the templates and produce a set of test cases for each math function
that are specific to the target platform but still independent of
the real floating type.  The results of the processing are
"libm-test.c" and a file "libm-test-ulps.h" with platform specific
deltas by which the actual math function results may deviate from
the expected results and still be considered correct.

The test drivers "test-double.c", "test-float.c", and "test-ldouble.c"
test the normal double, float and long double implementation of libm.
The test drivers with an 'i' in their name ("test-idouble.c",
"test-ifloat.c", and "test-ildoubl.c") test the corresponding inline
functions (where available - otherwise they also test the real
functions in libm).  Each driver selects the desired real floating
type to exercise the math functions to test with (float, double, or
long double) by defining a small set of macros just before including
the generic "libm-test.c" file.  Each driver also either defines or
undefines the __NO_MATH_INLINES macro just before including
"libm-test.c" to select either the real or inline functions,
respectively.  Each driver is compiled into a single executable test
program with the corresponding name.

As mentioned above, the "gen-libm-test.pl" script looks for a file
named "libm-test-ulps" in the platform specific sysdep directory (or
its fpu or nofpu subdirectory) and for each variant (real floating
type and rounding mode) of every tested function reads from it the
maximum difference expressed as Units of Least Precision (ULP) the
actual result of the function may deviate from the expected result
before it's considered incorrect.

The "auto-libm-test-out" file contains sets of test cases to exercise,
the conditions under which to exercise each, and the expected results.
The file is generated by the "gen-auto-libm-tests" program from the
"auto-libm-test-in" file.  See the comments in gen-auto-libm-tests.c
for details about the content and format of the -in and -out files.

How can I generate "libm-test-ulps"?
====================================

To automatically generate a new "libm-test-ulps" run "make regen-ulps".
This generates the file "math/NewUlps" in the build directory.  The file
contains the sorted results of all the tests.  You can use the "NewUlps"
file as the machine's updated "libm-test-ulps" file.  Copy "NewUlps" to
"libm-test-ulps" in the appropriate machine sysdep directory.  Verify
the changes, post your patch, and check it in after review.

To manually generate a new "libm-test-ulps" file, first remove "ULPs"
file in the current directory, then you can execute for example:
    ./testrun.sh math/test-double -u --ignore-max-ulp=yes
This generates a file "ULPs" with all double ULPs in it, ignoring any
previously calculated ULPs, and running with the newly built dynamic
loader and math library (assumes you didn't install your build).  Now
generate the ULPs for all other formats, the tests will be appending the
data to the "ULPs" file.  As final step run "gen-libm-test.pl" with the
file as input and ask to generate a pretty printed output in the file
"NewUlps":
  gen-libm-test.pl -u ULPs -n
Copy "NewUlps" to "libm-test-ulps" in the appropriate machine sysdep
directory.

Note that the test drivers have an option "-u" to output an unsorted
list of all epsilons that the functions have.  The output can be read
in directly but it's better to pretty print it first.
"gen-libm-test.pl" has an option to generate a pretty-printed and
sorted new ULPs file from the output of the test drivers.

Contents of libm-test-ulps
==========================

Since libm-test-ulps can be generated automatically, just a few notes.
The file contains lines for maximal errors of single functions, like:

Function "yn":
idouble: 6

The keywords are float, ifloat, double, idouble, ldouble and ildouble
(the prefix i stands for inline).

Adding tests to libm-test.inc
=============================

The tests are evaluated by a set of special test macros.  The macros
start with "TEST_" followed by a specification the input values, an
underscore and a specification of the output values.  As an example,
the test macro for a function with input of type FLOAT (FLOAT is
either float, double, long double) and output of type FLOAT is
"TEST_f_f".  The macro's parameter are the name of the function, the
input parameter, output parameter and optionally one exception
parameter.

The accepted parameter types are:
- "f" for FLOAT
- "b" for boolean - just tests if the output parameter evaluates to 0
  or 1 (only for output).
- "c" for complex.  This parameter needs two values, first the real,
  then the imaginary part.
- "i" for int.
- "l" for long int.
- "L" for long long int.
- "F" for the address of a FLOAT (only as input parameter)
- "I" for the address of an int (only as input parameter)

How to read the test output
===========================

Running each test on its own at the default level of verbosity will
print on stdout a line describing the implementation of math functions
exercised by the test (float, double, or long double), along with
whether the inline set has been selected, regardless of whether or
not any inline functions actually exist.  This is then followed by
the details of test failures (if any).  The output concludes by
a summary listing the number of test cases exercised and the number
of test failures uncovered.

For each test failure (and for each test case at higher levels of
verbosity), the output contains the name of the function under test
and its arguments or conditions that triggered the failure.  Note
that the name of the function in the output need not correspond
exactly to the name of the math function actually invoked. For example,
the output will refer to the "acos" function even if the actual function
under test is acosf (for the float version) or acosl (for the long
double version).  Also note that the function arguments may be shown
in either the decimal or the  hexadecimal floating point format which
may or may not correspond to the format used in the auto-libm-test-in
file. Besides the name of the function, for each test failure the
output contains the actual and expected results and the difference
between the two, printed in both the decimal and hexadecimal
floating point format, and the ULP and maximum ULP for the test
case.