glibc/math
Joseph Myers 423c2b9d08 Add fromfp functions.
TS 18661-1 defines fromfp functions (fromfp, fromfpx, ufromfp,
ufromfpx, and float and long double variants) to convert from
floating-point to an integer type with any signedness and any given
width up to that of intmax_t, in any of the five IEEE rounding modes
(the usual four for binary floating point, plus rounding to nearest
with ties rounding away from zero), with control of whether in-range
non-integer values should result in the "inexact" exception being
raised.  This patch implements these functions for glibc.

These implementations are (apart from raising exceptions) pure integer
implementations; it's entirely possible optimized versions could be
devised for some architectures.  A common math/fromfp.h header
provides various common helper code that can readily be shared between
the implementations for different types.  For each type, the bulk of
the implementation is also shared between the four functions, with
wrappers that define UNSIGNED and INEXACT macros appropriately before
including the main implementation.

As the functions return intmax_t and uintmax_t without math.h being
allowed to expose those typedef names, they are declared using
__intmax_t and __uintmax_t as obtained from <bits/types.h>.

The FP_INT_* rounding direction macros are defined as ascending
integers in the order the names are listed in the TS; I see no
significant value in allowing architectures to vary the values of
them.

The libm-test machinery is duly adapted to handle unsigned int
arguments, and intmax_t and uintmax_t results.  Because each test
input is generally tested for four functions, five rounding modes and
several different widths, the libm-test.inc additions are very large.
Thus, the diffs in the body of this message exclude the libm-test.inc
changes, with the full patch being attached gzipped.  The bulk of the
new tests were generated (expanded from a test input plus rounding
results and information about where it lies in the relevant interval
between integers, to libm-test tests for all relevant combinations of
function, rounding direction and width) by a script that's included in
the patch as math/gen-fromfp-tests.py (input data
math/gen-fromfp-tests-inputs); as an ad hoc script that's not really
expected to be rerun, it's not very polished, but it's at least
plausibly useful for adding any further tests for these functions in
future.  I may split the libm-test tests up by function in future (so
both libm-test.inc and auto-libm-test-out are split into separate
files, and the tests for each function are also built and run
separately), but not for 2.25.

For no obvious reason, adding tgmath tests for the new functions
resulted in -Wuninitialized errors from test-tgmath.c about the
variable i being used uninitialized.  Those errors were correct - the
variable is read by the frexp version in test-tgmath.c (where real
frexp would write through that pointer instead of reading it) - but I
don't know why this patch would result in the pre-existing issue being
newly detected.  The patch initializes the variable to avoid those
errors.

With these changes, glibc 2.25 should have all the library features
from TS 18661-1 other than the functions that round result to narrower
type (and constant rounding directions, but I'm considering those
mainly a compiler feature not a library one).

Tested for x86_64, x86, mips64 and powerpc.

	* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(fromfp): New declaration.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfpx): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfp): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfpx): Likewise.
	* math/tgmath.h (__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): New macro.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfp): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfp): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfpx): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfpx): Likewise.
	* math/math.h: Include <bits/types.h>.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_INT_UPWARD): New enum
	constant and macro.
	(FP_INT_DOWNWARD): Likewise.
	(FP_INT_TOWARDZERO): Likewise.
	(FP_INT_TONEARESTFROMZERO): Likewise.
	(FP_INT_TONEAREST): Likewise.
	* math/Versions (fromfp): New libm symbol at version GLIBC_2.25.
	(fromfpf): Likewise.
	(fromfpl): Likewise.
	(ufromfp): Likewise.
	(ufromfpf): Likewise.
	(ufromfpl): Likewise.
	(fromfpx): Likewise.
	(fromfpxf): Likewise.
	(fromfpxl): Likewise.
	(ufromfpx): Likewise.
	(ufromfpxf): Likewise.
	(ufromfpxl): Likewise.
	* math/Makefile (libm-calls): Add s_fromfpF, s_ufromfpF,
	s_fromfpxF and s_ufromfpxF.
	* math/gen-fromfp-tests.py: New file.
	* math/gen-fromfp-tests-inputs: Likewise.
	* math/libm-test.inc: Include <stdint.h>
	(check_intmax_t): New function.
	(check_uintmax_t): Likewise.
	(struct test_fiu_M_data): New type.
	(struct test_fiu_U_data): Likewise.
	(RUN_TEST_fiu_M): New macro.
	(RUN_TEST_LOOP_fiu_M): Likewise.
	(RUN_TEST_fiu_U): Likewise.
	(RUN_TEST_LOOP_fiu_U): Likewise.
	(fromfp_test_data): New array.
	(fromfp_test): New function.
	(fromfpx_test_data): New array.
	(fromfpx_test): New function.
	(ufromfp_test_data): New array.
	(ufromfp_test): New function.
	(ufromfpx_test_data): New array.
	(ufromfpx_test): New function.
	(main): Call fromfp_test, fromfpx_test, ufromfp_test and
	ufromfpx_test.
	* math/gen-libm-test.pl (parse_args): Handle u, M and U descriptor
	characters.
	* math/test-tgmath-ret.c: Include <stdint.h>.
	(rm): New variable.
	(width): Likewise.
	(CHECK_RET_CONST_TYPE): Take extra arguments and pass them to
	called function.
	(CHECK_RET_CONST_FLOAT): Take extra arguments and pass them to
	CHECK_RET_CONST_TYPE.
	(CHECK_RET_CONST_DOUBLE): Likewise.
	(CHECK_RET_CONST_LDOUBLE): Likewise.
	(CHECK_RET_CONST): Take extra arguments and pass them to calls
	macros.
	(fromfp): New CHECK_RET_CONST call.
	(ufromfp): Likewise.
	(fromfpx): Likewise.
	(ufromfpx): Likewise.
	(do_test): Call check_return_fromfp, check_return_ufromfp,
	check_return_fromfpx and check_return_ufromfpx.
	* math/test-tgmath.c: Include <stdint.h>
	(NCALLS): Increase to 138.
	(F(compile_test)): Initialize i.  Call fromfp functions.
	(F(fromfp)): New function.
	(F(fromfpx)): Likewise.
	(F(ufromfp)): Likewise.
	(F(ufromfpx)): Likewise.
	* manual/arith.texi (Rounding Functions): Document FP_INT_UPWARD,
	FP_INT_DOWNWARD, FP_INT_TOWARDZERO, FP_INT_TONEARESTFROMZERO,
	FP_INT_TONEAREST, fromfp, fromfpf, fromfpl, ufromfp, ufromfpf,
	ufromfpl, fromfpx, fromfpxf, fromfpxl, ufromfpx, ufromfpxf and
	ufromfpxl.
	* manual/libm-err-tab.pl (@all_functions): Add fromfp, fromfpx,
	ufromfp and ufromfpx.
	* math/fromfp.h: New file.
	* sysdeps/ieee754/dbl-64/s_fromfp.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fromfp_main.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fromfpx.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_ufromfp.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_ufromfpx.c: Likewise.
	* sysdeps/ieee754/flt-32/s_fromfpf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_fromfpf_main.c: Likewise.
	* sysdeps/ieee754/flt-32/s_fromfpxf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_ufromfpf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_ufromfpxf.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fromfpl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fromfpl_main.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fromfpxl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_ufromfpl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_ufromfpxl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fromfpl_main.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fromfpl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fromfpl_main.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fromfpxl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_ufromfpl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_ufromfpxl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fromfp,
	ufromfp, fromfpx and ufromfpx.
	(CFLAGS-nldbl-fromfp.c): New variable.
	(CFLAGS-nldbl-fromfpx.c): Likewise.
	(CFLAGS-nldbl-ufromfp.c): Likewise.
	(CFLAGS-nldbl-ufromfpx.c): Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-compat.h: Include <stdint.h>.
	* sysdeps/ieee754/ldbl-opt/nldbl-fromfp.c: New file.
	* sysdeps/ieee754/ldbl-opt/nldbl-fromfpx.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-ufromfp.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-ufromfpx.c: Likewise.
	* sysdeps/nacl/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2016-12-31 00:40:59 +00:00
..
bits Add fromfp functions. 2016-12-31 00:40:59 +00:00
machine
atest-exp2.c Fix building glibc master with NDEBUG and --with-cpu. 2016-03-15 23:23:24 -04:00
atest-exp.c Fix building glibc master with NDEBUG and --with-cpu. 2016-03-15 23:23:24 -04:00
atest-sincos.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
auto-libm-test-in Fix cos computation for multiple precision fallback (bz #20357) 2016-07-18 22:33:09 +05:30
auto-libm-test-out Fix cos computation for multiple precision fallback (bz #20357) 2016-07-18 22:33:09 +05:30
basic-test.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
bug-nextafter.c Make more libm tests condition exceptions tests with math-tests.h. 2013-06-12 12:41:25 +00:00
bug-nexttoward.c Make more libm tests condition exceptions tests with math-tests.h. 2013-06-12 12:41:25 +00:00
bug-tgmath1.c Update. 2004-05-07 02:14:18 +00:00
cabs_template.c Support for type-generic libm function implementations libm 2016-08-17 14:06:03 -05:00
carg_template.c Support for type-generic libm function implementations libm 2016-08-17 14:06:03 -05:00
cimag_template.c Support for type-generic libm function implementations libm 2016-08-17 14:06:03 -05:00
complex.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
conj_template.c Support for type-generic libm function implementations libm 2016-08-17 14:06:03 -05:00
creal_template.c Support for type-generic libm function implementations libm 2016-08-17 14:06:03 -05:00
divtc3.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_acoshl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_acosl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_asinl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_atan2l.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_atanhl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_coshl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_exp2l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_exp10.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_exp10f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_exp10l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_expl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_fmodl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_gammal_r.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_hypotl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_j0l.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_j1l.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_jnl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_lgammal_r.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_log2l.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_log10l.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_logl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_powl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_rem_pio2l.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_scalb.c Do not call __nan in scalb functions. 2016-08-04 20:50:31 +00:00
e_scalbf.c Do not call __nan in scalb functions. 2016-08-04 20:50:31 +00:00
e_scalbl.c Do not call __nan in scalb functions. 2016-08-04 20:50:31 +00:00
e_sinhl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
e_sqrtl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
fclrexcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fedisblxcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
feenablxcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fegetenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fegetexcept.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fegetmode.c Add femode_t functions. 2016-09-07 16:40:09 +00:00
fegetround.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
feholdexcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fenv.h Define FE_SNANS_ALWAYS_SIGNAL. 2016-12-16 18:03:25 +00:00
fesetenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fesetexcept.c Add fesetexcept. 2016-08-16 16:16:10 +00:00
fesetmode.c Add femode_t functions. 2016-09-07 16:40:09 +00:00
fesetround.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fetestexceptflag.c Add fetestexceptflag. 2016-08-29 11:47:21 +00:00
feupdateenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fgetexcptflg.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fpu_control.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fraiseexcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fromfp.h Add fromfp functions. 2016-12-31 00:40:59 +00:00
fsetexcptflg.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
ftestexcept.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
gen-auto-libm-tests.c Generate new format names in auto-libm-test-out 2016-06-08 14:56:04 -05:00
gen-fromfp-tests-inputs Add fromfp functions. 2016-12-31 00:40:59 +00:00
gen-fromfp-tests.py Add fromfp functions. 2016-12-31 00:40:59 +00:00
gen-libm-have-vector-test.sh Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
gen-libm-test.pl Add fromfp functions. 2016-12-31 00:40:59 +00:00
ieee-math.c
k_casinh_template.c Convert _Complex sine functions to generated code 2016-08-19 16:46:41 -05:00
k_cosl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
k_sincosl.c Moved to csu/errno-loc.c. 2005-12-14 15:06:39 +00:00
k_sinl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
k_tanl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
lgamma-compat.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
libm-test.inc Add fromfp functions. 2016-12-31 00:40:59 +00:00
Makefile Add fromfp functions. 2016-12-31 00:40:59 +00:00
math.h Add fromfp functions. 2016-12-31 00:40:59 +00:00
mul_split.h Merge common usage of mul_split function 2016-08-19 11:29:43 -05:00
mul_splitl.h Merge common usage of mul_split function 2016-08-19 11:29:43 -05:00
multc3.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00: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 [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
s_atanl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
s_cacos_template.c Convert _Complex cosine functions to generated code 2016-08-19 11:28:55 -05:00
s_cacosh_template.c Convert _Complex cosine functions to generated code 2016-08-19 11:28:55 -05:00
s_canonicalize_template.c Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
s_casin_template.c Convert _Complex sine functions to generated code 2016-08-19 16:46:41 -05:00
s_casinh_template.c Convert _Complex sine functions to generated code 2016-08-19 16:46:41 -05:00
s_catan_template.c Convert _Complex tangent functions to generated code 2016-08-19 16:47:31 -05:00
s_catanh_template.c Convert _Complex tangent functions to generated code 2016-08-19 16:47:31 -05:00
s_cbrtl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
s_ccos_template.c Convert _Complex cosine functions to generated code 2016-08-19 11:28:55 -05:00
s_ccosh_template.c Clean up some complex functions raising FE_INVALID. 2016-10-14 00:12:56 +00:00
s_cexp_template.c Clean up some complex functions raising FE_INVALID. 2016-10-14 00:12:56 +00:00
s_clog10_template.c Convert remaining complex function to generated files 2016-08-29 12:43:38 -05:00
s_clog_template.c Convert remaining complex function to generated files 2016-08-29 12:43:38 -05:00
s_cpow_template.c Convert remaining complex function to generated files 2016-08-29 12:43:38 -05:00
s_cproj_template.c Convert remaining complex function to generated files 2016-08-29 12:43:38 -05:00
s_csin_template.c Clean up some complex functions raising FE_INVALID. 2016-10-14 00:12:56 +00:00
s_csinh_template.c Clean up some complex functions raising FE_INVALID. 2016-10-14 00:12:56 +00:00
s_csqrt_template.c Convert remaining complex function to generated files 2016-08-29 12:43:38 -05:00
s_ctan_template.c Convert _Complex tangent functions to generated code 2016-08-19 16:47:31 -05:00
s_ctanh_template.c Convert _Complex tangent functions to generated code 2016-08-19 16:47:31 -05:00
s_erfl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
s_expm1l.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
s_fdim_template.c Make common fdim implementation generic. 2016-09-01 09:28:05 -05:00
s_fma.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmaf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmal.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmax_template.c Fix generic fmax, fmin sNaN handling (bug 20947). 2016-12-14 22:41:26 +00:00
s_fmaxmag_template.c Add fmaxmag, fminmag functions. 2016-12-20 00:46:53 +00:00
s_fmin_template.c Fix generic fmax, fmin sNaN handling (bug 20947). 2016-12-14 22:41:26 +00:00
s_fminmag_template.c Add fmaxmag, fminmag functions. 2016-12-20 00:46:53 +00:00
s_iscanonicall.c Add iscanonical. 2016-09-30 00:27:50 +00:00
s_iseqsig_template.c Fix iseqsig for ports that do not support FE_INVALID 2016-10-07 14:18:31 -03:00
s_ldexp_template.c Make ldexpF generic. 2016-09-20 14:37:40 -05:00
s_log1pl.c Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
s_nan_template.c Build s_nan* objects from a generic template 2016-09-20 14:37:42 -05:00
s_nextafter.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_nextdown_template.c Make common nextdown implementation generic. 2016-09-01 09:31:03 -05:00
s_nexttowardf.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_nexttowardl.c Moved to csu/errno-loc.c. 2005-12-14 15:06:39 +00:00
s_significand.c Remove __STDC__ conditionals from libm. 2012-01-27 17:29:45 +00:00
s_significandf.c Remove __STDC__ conditionals from libm. 2012-01-27 17:29:45 +00:00
s_significandl.c Remove __STDC__ conditionals from libm. 2012-01-27 17:29:45 +00:00
s_tanhl.c [BZ #157] Remove include/stub-tag.h for good. 2012-11-04 19:59:40 +01:00
setfpucw.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
t_sincosl.c Moved to csu/errno-loc.c. 2005-12-14 15:06:39 +00:00
test-double-finite.c Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-double-vlen2.h Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-double-vlen4.h Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-double-vlen8.h Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-double.c Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-double.h Replace use of snprintf with strfrom in libm tests 2016-12-20 17:58:20 -02:00
test-fe-snans-always-signal.c Define FE_SNANS_ALWAYS_SIGNAL. 2016-12-16 18:03:25 +00:00
test-femode-traps.c Add femode_t functions. 2016-09-07 16:40:09 +00:00
test-femode.c Add femode_t functions. 2016-09-07 16:40:09 +00:00
test-fenv-clear-main.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +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. 2016-01-04 16:05:18 +00:00
test-fenv-return.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-fenv-tls.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-fenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-fenvinline.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-fesetexcept-traps.c Add fesetexcept. 2016-08-16 16:16:10 +00:00
test-fesetexcept.c Add fesetexcept. 2016-08-16 16:16:10 +00:00
test-fetestexceptflag.c Add fetestexceptflag. 2016-08-29 11:47:21 +00:00
test-fexcept-traps.c Add tests for fegetexceptflag, fesetexceptflag. 2016-08-10 21:01:08 +00:00
test-fexcept.c Fix test-fexcept when "inexact" implicitly raised. 2016-08-12 17:34:01 +00:00
test-float-finite.c Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-float-vlen4.h Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-float-vlen8.h Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-float-vlen16.h Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-float.c Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-float.h Replace use of snprintf with strfrom in libm tests 2016-12-20 17:58:20 -02:00
test-flt-eval-method.c Fix default float_t definition (bug 20855). 2016-11-23 00:28:30 +00:00
test-fp-ilogb-constants.c Fix SH4 FP_ILOGB0 (bug 20859). 2016-11-23 21:23:12 +00:00
test-fp-llogb-constants.c Add llogb, llogbf, llogbl. 2016-12-02 01:42:49 +00:00
test-fpucw-ieee-static.c Fix static-binary lazy FPU context allocation 2013-09-09 22:36:57 +01:00
test-fpucw-ieee.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-fpucw-static.c Fix math/test-fpucw-*.c for sysdeps test-fpucw.c overrides. 2014-01-16 05:30:52 +00:00
test-fpucw.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-idouble.c Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-ifloat.c Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-ildouble.c Refactor part of math Makefile 2016-08-03 11:05:22 -05:00
test-iseqsig-excess-precision.c Make iseqsig handle excess precision. 2016-10-07 23:28:33 +00:00
test-iszero-excess-precision.c Fix iszero for excess precision. 2016-09-28 21:11:58 +00:00
test-ldouble-finite.c Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-ldouble.c Remove CHOOSE() macro from libm-tests.inc 2016-06-08 14:37:15 -05:00
test-ldouble.h Replace use of snprintf with strfrom in libm tests 2016-12-20 17:58:20 -02:00
test-math-errno.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-math-finite.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-math-inline.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-math-isinff.cc Don't use long double math functions if NO_LONG_DOUBLE 2016-02-24 11:59:42 +01:00
test-math-iszero.cc math: Define iszero as a function template for C++ [BZ #20715] 2016-10-21 18:26:53 +02:00
test-math-no-finite.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-math-no-inline.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-math-scalar.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-math-vector.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +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. 2016-01-04 16:05:18 +00:00
test-nan-overflow.c Add missing include for stdlib.h. 2016-10-28 12:45:27 -04:00
test-nan-payload.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-nearbyint-except-2.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-nearbyint-except.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-powl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-signgam-finite-c11.c Fix finite-math-only lgamma functions signgam setting (bug 19211). 2015-11-05 21:23:07 +00:00
test-signgam-finite-c99.c Fix compilation of test-signgam-* tests 2016-03-15 00:03:03 +01:00
test-signgam-finite.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-signgam-main.c Fix compilation of test-signgam-* tests 2016-03-15 00:03:03 +01:00
test-signgam-uchar-init-static.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-uchar-init.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-uchar-static.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-uchar.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-uint-init-static.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-uint-init.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-uint-static.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-uint.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-ullong-init-static.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-ullong-init.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-ullong-static.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-signgam-ullong.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
test-snan.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-tgmath2.c Speed up math/test-tgmath2.c 2016-11-04 15:59:22 -07:00
test-tgmath-int.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-tgmath-ret.c Add fromfp functions. 2016-12-31 00:40:59 +00:00
test-tgmath.c Add fromfp functions. 2016-12-31 00:40:59 +00:00
tgmath.h Add fromfp functions. 2016-12-31 00:40:59 +00:00
tst-CMPLX2.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-CMPLX.c Don't disable CMPLXL macro for __NO_LONG_DOUBLE_MATH (bug 15488). 2013-05-18 12:12:38 +00:00
tst-definitions.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Versions Add fromfp functions. 2016-12-31 00:40:59 +00:00
w_acos.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_acosf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_acosh.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_acoshf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_acoshl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_acosl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_asin.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_asinf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_asinl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_atan2.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_atan2f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_atan2l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_atanh.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_atanhf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_atanhl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +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 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_exp10f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_exp10l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_expl.c Moved to csu/errno-loc.c. 2005-12-14 15:06:39 +00:00
w_fmod.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_fmodf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_fmodl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00: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_template.c Make ilogb wrappers type-generic. 2016-11-28 23:27:23 +00:00
w_j0.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_j0f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_j0l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_j1.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_j1f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_j1l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_jn.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_jnf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +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_compat.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
w_lgamma_compatf.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
w_lgamma_compatl.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
w_lgamma_main.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00: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 Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
w_lgammaf_main.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00: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 Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
w_lgammal_main.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00: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 Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
w_llogb_template.c Add llogb, llogbf, llogbl. 2016-12-02 01:42:49 +00:00
w_log1p_template.c Make w_log1p type-generic 2016-12-14 11:19:33 -02:00
w_log2.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_log2f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_log2l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_log10.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_log10f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_log10l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_log.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_logf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_logl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_pow.c Fix pow (qNaN, 0) result with -lieee (bug 20919), remove dead parts of wrappers. 2016-12-02 22:50:46 +00:00
w_powf.c Fix pow (qNaN, 0) result with -lieee (bug 20919), remove dead parts of wrappers. 2016-12-02 22:50:46 +00:00
w_powl.c Fix pow (qNaN, 0) result with -lieee (bug 20919), remove dead parts of wrappers. 2016-12-02 22:50:46 +00:00
w_remainder.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_remainderf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_remainderl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_scalb.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_scalbf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_scalbl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_scalbln_template.c Make w_scalbln type-generic 2016-12-16 08:44:19 -02: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. 2016-01-04 16:05:18 +00:00
w_sqrtf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_sqrtl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +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.