diff options
author | Joseph Myers <joseph@codesourcery.com> | 2016-12-20 00:46:53 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2016-12-20 00:46:53 +0000 |
commit | 525f803984f278e65dc07ca1156bdeca63755810 (patch) | |
tree | 776b2000f6c8a0d5d3a0141f9b4b5aa5492da119 /math/libm-test.inc | |
parent | 353683a22ed8a493a6bd1d78d63e144bc3e85d2f (diff) | |
download | glibc-525f803984f278e65dc07ca1156bdeca63755810.tar.gz glibc-525f803984f278e65dc07ca1156bdeca63755810.tar.xz glibc-525f803984f278e65dc07ca1156bdeca63755810.zip |
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.
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r-- | math/libm-test.inc | 233 |
1 files changed, 231 insertions, 2 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index 110b4215d5..1860b9c41d 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -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 (); |