Add fmaxmag, fminmag functions.

TS 18661-1 defines fmaxmag and fminmag functions that return the
argument with maximum / minimum magnitude (acting like fmax / fmin if
the arguments have the same magnitude or either argument is a NaN).
These correspond to the IEEE 754-2008 operations maxNumMag and
minNumMag.  This patch implements these functions for glibc.  They are
implemented with type-generic templates.  Tests are based on those for
fmax and fmin.

Tested for x86_64, x86, mips64 and powerpc.

	* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(fmaxmag): New declaration.
	(fminmag): Likewise.
	* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New
	macro.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (fminmag): Likewise.
	* math/Versions (fmaxmag): New libm symbol at version GLIBC_2.25.
	(fmaxmagf): Likewise.
	(fmaxmagl): Likewise.
	(fminmag): Likewise.
	(fminmagf): Likewise.
	(fminmagl): Likewise.
	* math/Makefile (gen-libm-calls): Add s_fmaxmagF and s_fminmagF.
	* math/s_fmaxmag_template.c: New file.
	* math/s_fminmag_template.c: Likewise.
	* math/libm-test.inc (fmaxmag_test_data): New array.
	(fmaxmag_test): New function.
	(fminmag_test_data): New array.
	(fminmag_test): New function.
	(main): Call fmaxmag_test and fminmag_test.
	* math/test-tgmath.c (NCALLS): Increase to 132.
	(F(compile_test)): Call fmaxmag and fminmag.
	(F(fminmag)): New function.
	(F(fmaxmag)): Likewise.
	* manual/arith.texi (Misc FP Arithmetic): Document fminmag,
	fminmagf, fminmagl, fmaxmag, fmaxmagf and fmaxmagl.
	* manual/libm-err-tab.pl (@all_functions): Add fmaxmag and
	fminmag.
	* sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c: New file.
	* sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmaxmag
	and fminmag.
	(CFLAGS-nldbl-fmaxmag.c): New variable.
	(CFLAGS-nldbl-fminmag.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.
This commit is contained in:
Joseph Myers 2016-12-20 00:46:53 +00:00
parent 353683a22e
commit 525f803984
44 changed files with 677 additions and 6 deletions

View File

@ -1,3 +1,75 @@
2016-12-20 Joseph Myers <joseph@codesourcery.com>
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(fmaxmag): New declaration.
(fminmag): Likewise.
* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New
macro.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (fminmag): Likewise.
* math/Versions (fmaxmag): New libm symbol at version GLIBC_2.25.
(fmaxmagf): Likewise.
(fmaxmagl): Likewise.
(fminmag): Likewise.
(fminmagf): Likewise.
(fminmagl): Likewise.
* math/Makefile (gen-libm-calls): Add s_fmaxmagF and s_fminmagF.
* math/s_fmaxmag_template.c: New file.
* math/s_fminmag_template.c: Likewise.
* math/libm-test.inc (fmaxmag_test_data): New array.
(fmaxmag_test): New function.
(fminmag_test_data): New array.
(fminmag_test): New function.
(main): Call fmaxmag_test and fminmag_test.
* math/test-tgmath.c (NCALLS): Increase to 132.
(F(compile_test)): Call fmaxmag and fminmag.
(F(fminmag)): New function.
(F(fmaxmag)): Likewise.
* manual/arith.texi (Misc FP Arithmetic): Document fminmag,
fminmagf, fminmagl, fmaxmag, fmaxmagf and fmaxmagl.
* manual/libm-err-tab.pl (@all_functions): Add fmaxmag and
fminmag.
* sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmaxmag
and fminmag.
(CFLAGS-nldbl-fmaxmag.c): New variable.
(CFLAGS-nldbl-fminmag.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-19 Torvald Riegel <triegel@redhat.com>
[BZ #20973]

3
NEWS
View File

@ -69,6 +69,9 @@ Version 2.25
- llogb functions: the llogb, llogbf and llogbl functions, and the
FP_LLOGB0 and FP_LLOGBNAN macros.
- Max-min magnitude functions: fmaxmag, fmaxmagf, fmaxmagl, fminmag,
fminmagf, fminmagl.
- Comparison macros: iseqsig.
- Classification macros: iscanonical, issubnormal, iszero.

View File

@ -2155,6 +2155,38 @@ If an argument is NaN, the other argument is returned. If both arguments
are NaN, NaN is returned.
@end deftypefun
@comment math.h
@comment ISO
@deftypefun double fminmag (double @var{x}, double @var{y})
@comment math.h
@comment ISO
@deftypefunx float fminmagf (float @var{x}, float @var{y})
@comment math.h
@comment ISO
@deftypefunx {long double} fminmagl (long double @var{x}, long double @var{y})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
These functions, from TS 18661-1:2014, return whichever of the two
values @var{x} and @var{y} has the smaller absolute value. If both
have the same absolute value, or either is NaN, they behave the same
as the @code{fmin} functions.
@end deftypefun
@comment math.h
@comment ISO
@deftypefun double fmaxmag (double @var{x}, double @var{y})
@comment math.h
@comment ISO
@deftypefunx float fmaxmagf (float @var{x}, float @var{y})
@comment math.h
@comment ISO
@deftypefunx {long double} fmaxmagl (long double @var{x}, long double @var{y})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
These functions, from TS 18661-1:2014, return whichever of the two
values @var{x} and @var{y} has the greater absolute value. If both
have the same absolute value, or either is NaN, they behave the same
as the @code{fmax} functions.
@end deftypefun
@comment math.h
@comment ISO
@deftypefun double fdim (double @var{x}, double @var{y})

View File

@ -57,7 +57,7 @@ use vars qw (%results @all_floats %suffices @all_functions);
"clog", "clog10", "conj", "copysign", "cos", "cosh", "cpow", "cproj",
"creal", "csin", "csinh", "csqrt", "ctan", "ctanh", "erf", "erfc",
"exp", "exp10", "exp2", "expm1", "fabs", "fdim", "floor", "fma",
"fmax", "fmin", "fmod", "frexp", "gamma", "hypot",
"fmax", "fmaxmag", "fmin", "fminmag", "fmod", "frexp", "gamma", "hypot",
"ilogb", "j0", "j1", "jn", "lgamma", "llogb", "lrint",
"llrint", "log", "log10", "log1p", "log2", "logb", "lround",
"llround", "modf", "nearbyint", "nextafter", "nextdown", "nexttoward",

View File

@ -54,7 +54,7 @@ gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \
s_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF \
s_cpowF s_clog10F s_fdimF s_nextdownF s_fmaxF s_fminF \
s_nanF s_iseqsigF s_canonicalizeF w_ilogbF w_llogbF \
w_log1pF w_scalblnF
w_log1pF w_scalblnF s_fmaxmagF s_fminmagF
libm-calls = \
e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \

View File

@ -224,5 +224,6 @@ libm {
setpayload; setpayloadf; setpayloadl;
setpayloadsig; setpayloadsigf; setpayloadsigl;
llogb; llogbf; llogbl;
fmaxmag; fmaxmagf; fmaxmagl; fminmag; fminmagf; fminmagl;
}
}

View File

@ -385,6 +385,12 @@ __END_NAMESPACE_C99
#endif
#if __GLIBC_USE (IEC_60559_BFP_EXT)
/* Return value with maximum magnitude. */
__MATHCALLX (fmaxmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
/* Return value with minimum magnitude. */
__MATHCALLX (fminmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
/* Test equality. */
__MATHDECL_1 (int, __iseqsig,, (_Mdouble_ __x, _Mdouble_ __y));

View File

@ -45,8 +45,8 @@
acos, acosh, asin, asinh, atan, atan2, atanh,
canonicalize, cbrt, ceil, copysign, cos, cosh, drem,
erf, erfc, exp, exp10, exp2, expm1,
fabs, fdim, finite, floor, fma, fmax, fmin, fmod, fpclassify,
frexp, gamma, getpayload, hypot,
fabs, fdim, finite, floor, fma, fmax, fmaxmag, fmin, fminmag,
fmod, fpclassify, frexp, gamma, getpayload, hypot,
ilogb, iscanonical, isfinite, isinf, isnan, isnormal, issignaling,
issubnormal, iszero, iseqsig, isless, islessequal, isgreater,
isgreaterequal, islessgreater, isunordered, j0, j1, jn,
@ -7864,6 +7864,120 @@ fmax_test (void)
}
static const struct test_ff_f_data fmaxmag_test_data[] =
{
TEST_ff_f (fmaxmag, 0, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, minus_zero, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 0, minus_zero, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED|IGNORE_ZERO_INF_SIGN),
TEST_ff_f (fmaxmag, minus_zero, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED|IGNORE_ZERO_INF_SIGN),
TEST_ff_f (fmaxmag, min_subnorm_value, min_subnorm_value, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, min_subnorm_value, -min_subnorm_value, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -min_subnorm_value, min_subnorm_value, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -min_subnorm_value, -min_subnorm_value, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, min_value, min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, min_value, -min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -min_value, min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -min_value, -min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, max_value, max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, max_value, -max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -max_value, max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -max_value, -max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, max_value, min_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, max_value, -min_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -max_value, min_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -max_value, -min_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, min_value, max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, min_value, -max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -min_value, max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -min_value, -max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 9, 0, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 0, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -9, 0, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 0, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, plus_infty, 9, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 0, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -9, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, plus_infty, -9, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, minus_infty, 9, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, minus_infty, -9, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 9, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -9, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 0, qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 0, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, minus_zero, qnan_value, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, minus_zero, -qnan_value, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 9, qnan_value, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 9, -qnan_value, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -9, qnan_value, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -9, -qnan_value, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, 0, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, 0, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, minus_zero, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, minus_zero, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, 9, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, 9, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -9, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -9, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, qnan_value, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -qnan_value, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, qnan_value, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -qnan_value, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, qnan_value, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -qnan_value, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, qnan_value, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -qnan_value, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, snan_value, 0, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -snan_value, 0, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, snan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -snan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, snan_value, 9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -snan_value, 9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, snan_value, -9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -snan_value, -9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, plus_infty, qnan_value, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, plus_infty, -qnan_value, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, minus_infty, qnan_value, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, minus_infty, -qnan_value, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, plus_infty, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, plus_infty, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, minus_infty, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, minus_infty, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, qnan_value, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -qnan_value, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, qnan_value, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -qnan_value, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, snan_value, plus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -snan_value, plus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, snan_value, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -snan_value, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, -qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fmaxmag, qnan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, qnan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -qnan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -qnan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, snan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, snan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -snan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -snan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, snan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, snan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -snan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fmaxmag, -snan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
};
static void
fmaxmag_test (void)
{
ALL_RM_TEST (fmaxmag, 1, fmaxmag_test_data, RUN_TEST_LOOP_ff_f, END);
}
static const struct test_ff_f_data fmin_test_data[] =
{
TEST_ff_f (fmin, 0, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
@ -7963,6 +8077,119 @@ fmin_test (void)
}
static const struct test_ff_f_data fminmag_test_data[] =
{
TEST_ff_f (fminmag, 0, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, minus_zero, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 0, minus_zero, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED|IGNORE_ZERO_INF_SIGN),
TEST_ff_f (fminmag, minus_zero, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED|IGNORE_ZERO_INF_SIGN),
TEST_ff_f (fminmag, min_subnorm_value, min_subnorm_value, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, min_subnorm_value, -min_subnorm_value, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -min_subnorm_value, min_subnorm_value, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -min_subnorm_value, -min_subnorm_value, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, min_value, min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, min_value, -min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -min_value, min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -min_value, -min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, max_value, max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, max_value, -max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -max_value, max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -max_value, -max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, max_value, min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, max_value, -min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -max_value, min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -max_value, -min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, min_value, max_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, min_value, -max_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -min_value, max_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -min_value, -max_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 9, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 0, 9, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -9, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 0, -9, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, plus_infty, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 9, plus_infty, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, plus_infty, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -9, plus_infty, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, minus_infty, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, minus_infty, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 9, minus_infty, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -9, minus_infty, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 0, qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 0, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, minus_zero, qnan_value, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, minus_zero, -qnan_value, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 9, qnan_value, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 9, -qnan_value, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -9, qnan_value, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -9, -qnan_value, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, 0, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, 0, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, minus_zero, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, minus_zero, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, 9, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, 9, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -9, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -9, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, qnan_value, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -qnan_value, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, qnan_value, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -qnan_value, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, qnan_value, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -qnan_value, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, qnan_value, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -qnan_value, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, snan_value, 0, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -snan_value, 0, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, snan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -snan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, snan_value, 9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -snan_value, 9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, snan_value, -9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -snan_value, -9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, plus_infty, qnan_value, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, plus_infty, -qnan_value, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, minus_infty, qnan_value, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, minus_infty, -qnan_value, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, plus_infty, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, plus_infty, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, minus_infty, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, minus_infty, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, qnan_value, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -qnan_value, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, qnan_value, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -qnan_value, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, snan_value, plus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -snan_value, plus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, snan_value, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -snan_value, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, -qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_ff_f (fminmag, qnan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, qnan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -qnan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -qnan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, snan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, snan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -snan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -snan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, snan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, snan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -snan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
TEST_ff_f (fminmag, -snan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
};
static void
fminmag_test (void)
{
ALL_RM_TEST (fminmag, 1, fminmag_test_data, RUN_TEST_LOOP_ff_f, END);
}
static const struct test_ff_f_data fmod_test_data[] =
{
/* fmod (+0, y) == +0 for y != 0. */
@ -14041,7 +14268,9 @@ main (int argc, char **argv)
/* maximum, minimum and positive difference functions */
fdim_test ();
fmax_test ();
fmaxmag_test ();
fmin_test ();
fminmag_test ();
/* Multiply and add: */
fma_test ();

38
math/s_fmaxmag_template.c Normal file
View File

@ -0,0 +1,38 @@
/* Return value with maximum magnitude.
Copyright (C) 2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <math.h>
FLOAT
M_DECL_FUNC (__fmaxmag) (FLOAT x, FLOAT y)
{
FLOAT ax = M_FABS (x);
FLOAT ay = M_FABS (y);
if (isgreater (ax, ay))
return x;
else if (isless (ax, ay))
return y;
else if (ax == ay)
return x > y ? x : y;
else if (issignaling (x) || issignaling (y))
return x + y;
else
return isnan (y) ? x : y;
}
declare_mgen_alias (__fmaxmag, fmaxmag);

38
math/s_fminmag_template.c Normal file
View File

@ -0,0 +1,38 @@
/* Return value with minimum magnitude.
Copyright (C) 2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <math.h>
FLOAT
M_DECL_FUNC (__fminmag) (FLOAT x, FLOAT y)
{
FLOAT ax = M_FABS (x);
FLOAT ay = M_FABS (y);
if (isless (ax, ay))
return x;
else if (isgreater (ax, ay))
return y;
else if (ax == ay)
return x < y ? x : y;
else if (issignaling (x) || issignaling (y))
return x + y;
else
return isnan (y) ? x : y;
}
declare_mgen_alias (__fminmag, fminmag);

View File

@ -50,7 +50,7 @@ int count_cdouble;
int count_cfloat;
int count_cldouble;
#define NCALLS 126
#define NCALLS 132
#define NCALLS_INT 4
#define NCCALLS 47
@ -285,6 +285,8 @@ F(compile_test) (void)
a = fdim (fdim (x, a), fdim (c, b));
b = fmax (fmax (a, x), fmax (c, b));
a = fmin (fmin (x, a), fmin (c, b));
b = fmaxmag (fmaxmag (a, x), fmaxmag (c, b));
a = fminmag (fminmag (x, a), fminmag (c, b));
b = fma (sin (a), sin (x), sin (c));
a = totalorder (totalorder (x, b), totalorder (c, x));
b = totalordermag (totalordermag (x, a), totalordermag (c, x));
@ -384,6 +386,8 @@ F(compile_test) (void)
a = fdim (y, y);
a = fmax (y, y);
a = fmin (y, y);
a = fmaxmag (y, y);
a = fminmag (y, y);
a = fma (y, y, y);
a = totalorder (y, y);
a = totalordermag (y, y);
@ -880,6 +884,22 @@ TYPE
return x + y;
}
TYPE
(F(fminmag)) (TYPE x, TYPE y)
{
++count;
P ();
return x + y;
}
TYPE
(F(fmaxmag)) (TYPE x, TYPE y)
{
++count;
P ();
return x + y;
}
TYPE
(F(fma)) (TYPE x, TYPE y, TYPE z)
{

View File

@ -441,6 +441,12 @@
/* Like ilogb, but returning long int. */
#define llogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, llogb)
/* Return value with maximum magnitude. */
# define fmaxmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmaxmag)
/* Return value with minimum magnitude. */
# define fminmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminmag)
/* Total order operation. */
# define totalorder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, \
totalorder)

View File

@ -43,7 +43,7 @@ libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
isoc99_wscanf isoc99_fwscanf isoc99_swscanf \
isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf \
nextup nextdown totalorder totalordermag getpayload \
canonicalize setpayload setpayloadsig llogb
canonicalize setpayload setpayloadsig llogb fmaxmag fminmag
libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
libnldbl-inhibit-o = $(object-suffixes)
libnldbl-static-only-routines = $(libnldbl-routines)
@ -97,7 +97,9 @@ CFLAGS-nldbl-finite.c = -fno-builtin-finitel
CFLAGS-nldbl-floor.c = -fno-builtin-floorl
CFLAGS-nldbl-fma.c = -fno-builtin-fmal
CFLAGS-nldbl-fmax.c = -fno-builtin-fmaxl
CFLAGS-nldbl-fmaxmag.c = -fno-builtin-fmaxmagl
CFLAGS-nldbl-fmin.c = -fno-builtin-fminl
CFLAGS-nldbl-fminmag.c = -fno-builtin-fminmagl
CFLAGS-nldbl-fmod.c = -fno-builtin-fmodl
CFLAGS-nldbl-frexp.c = -fno-builtin-frexpl
CFLAGS-nldbl-gamma.c = -fno-builtin-gammal

View File

@ -0,0 +1,26 @@
/* Compatibility routine for IEEE double as long double for fmaxmag.
Copyright (C) 2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include "nldbl-compat.h"
double
attribute_hidden
fmaxmagl (double x, double y)
{
return fmaxmag (x, y);
}

View File

@ -0,0 +1,26 @@
/* Compatibility routine for IEEE double as long double for fminmag.
Copyright (C) 2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include "nldbl-compat.h"
double
attribute_hidden
fminmagl (double x, double y)
{
return fminmag (x, y);
}

View File

@ -0,0 +1,5 @@
/* fmaxmagl is not subject to complex aliasing rules. It was added in
glibc 2.25. */
#define declare_mgen_alias(from, to) weak_alias (M_SUF (from), M_SUF (to))
#include <math-type-macros-ldouble.h>
#include <s_fmaxmag_template.c>

View File

@ -0,0 +1,5 @@
/* fminmagl is not subject to complex aliasing rules. It was added in
glibc 2.25. */
#define declare_mgen_alias(from, to) weak_alias (M_SUF (from), M_SUF (to))
#include <math-type-macros-ldouble.h>
#include <s_fminmag_template.c>

View File

@ -389,6 +389,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -421,6 +421,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -431,6 +431,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -78,6 +78,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -390,6 +390,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -434,6 +434,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -363,6 +363,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -78,6 +78,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -432,6 +432,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -389,6 +389,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -391,6 +391,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -423,6 +423,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -389,6 +389,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -434,6 +434,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -433,6 +433,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -428,6 +428,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -109,6 +109,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -421,6 +421,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -419,6 +419,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -390,6 +390,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -424,6 +424,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -422,6 +422,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -390,6 +390,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -390,6 +390,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -390,6 +390,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -423,6 +423,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F

View File

@ -422,6 +422,12 @@ GLIBC_2.25 fegetmode F
GLIBC_2.25 fesetexcept F
GLIBC_2.25 fesetmode F
GLIBC_2.25 fetestexceptflag F
GLIBC_2.25 fmaxmag F
GLIBC_2.25 fmaxmagf F
GLIBC_2.25 fmaxmagl F
GLIBC_2.25 fminmag F
GLIBC_2.25 fminmagf F
GLIBC_2.25 fminmagl F
GLIBC_2.25 getpayload F
GLIBC_2.25 getpayloadf F
GLIBC_2.25 getpayloadl F