diff options
| author | Joseph Myers <joseph@codesourcery.com> | 2016-10-15 00:36:48 +0000 |
|---|---|---|
| committer | Joseph Myers <joseph@codesourcery.com> | 2016-10-15 00:36:48 +0000 |
| commit | cc6a8d74575e36e2c9da8454dd1d23000c5455dd (patch) | |
| tree | 8c7b1e3c8989409ef5ed166bbdf1cc97eaf7b7ef | |
| parent | e223d1fe72e820d96f43831412ab267a1ace04d0 (diff) | |
| download | glibc-cc6a8d74575e36e2c9da8454dd1d23000c5455dd.tar.xz glibc-cc6a8d74575e36e2c9da8454dd1d23000c5455dd.zip | |
Add totalordermag, totalordermagf, totalordermagl.
In addition to the totalorder functions, TS 18661-1 defines
totalordermag functions, which do the same comparison but on the
absolute values of the arguments. This patch implements these
functions for glibc, including the type-generic macro in <tgmath.h>.
In general the implementations are similar to but simpler than those
for the totalorder functions.
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(totalordermag): New declaration.
* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalordermag):
New macro.
* math/Versions (totalordermag): New libm symbol at version
GLIBC_2.25.
(totalordermagf): Likewise.
(totalordermagl): Likewise.
* math/Makefile (libm-calls): Add s_totalordermagF.
* math/libm-test.inc (totalordermag_test_data): New array.
(totalordermag_test): New function.
(main): Call totalordermag_test.
* math/test-tgmath.c (NCALLS): Increase to 125.
(F(compile_test)): Call totalordermag.
(F(totalordermag)): New function.
* manual/arith.texi (FP Comparison Functions): Document
totalordermag, totalordermagf and totalordermagl.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/dbl-64/s_totalordermag.c: New file.
* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Likewise.
* sysdeps/ieee754/flt-32/s_totalordermagf.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_totalordermagl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_totalordermagl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-totalordermag.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
totalordermag.
(CFLAGS-nldbl-totalordermag.c): New variable.
* sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c
(do_test): Also test totalordermagl.
* sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c (do_test):
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.
47 files changed, 786 insertions, 8 deletions
@@ -1,3 +1,72 @@ +2016-10-15 Joseph Myers <joseph@codesourcery.com> + + * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] + (totalordermag): New declaration. + * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalordermag): + New macro. + * math/Versions (totalordermag): New libm symbol at version + GLIBC_2.25. + (totalordermagf): Likewise. + (totalordermagl): Likewise. + * math/Makefile (libm-calls): Add s_totalordermagF. + * math/libm-test.inc (totalordermag_test_data): New array. + (totalordermag_test): New function. + (main): Call totalordermag_test. + * math/test-tgmath.c (NCALLS): Increase to 125. + (F(compile_test)): Call totalordermag. + (F(totalordermag)): New function. + * manual/arith.texi (FP Comparison Functions): Document + totalordermag, totalordermagf and totalordermagl. + * manual/libm-err-tab.pl: Update comment on interfaces without + ulps tabulated. + * sysdeps/ieee754/dbl-64/s_totalordermag.c: New file. + * sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Likewise. + * sysdeps/ieee754/flt-32/s_totalordermagf.c: Likewise. + * sysdeps/ieee754/ldbl-128/s_totalordermagl.c: Likewise. + * sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c: Likewise. + * sysdeps/ieee754/ldbl-96/s_totalordermagl.c: Likewise. + * sysdeps/ieee754/ldbl-opt/nldbl-totalordermag.c: Likewise. + * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add + totalordermag. + (CFLAGS-nldbl-totalordermag.c): New variable. + * sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c + (do_test): Also test totalordermagl. + * sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c (do_test): + 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-10-14 Steve Ellcey <sellcey@caviumnetworks.com> * sysdeps/ieee754/dbl-64/e_pow.c (checkint) Make conditions explicitly @@ -55,7 +55,8 @@ Version 2.25 - Classification macros: iscanonical, issubnormal, iszero. - - Total order functions: totalorder, totalorderf, totalorderl. + - Total order functions: totalorder, totalorderf, totalorderl, + totalordermag, totalordermagf, totalordermagl. * The <sys/quota.h> header now includes the <linux/quota.h> header. Support for the Linux quota interface which predates kernel version 2.4.22 has diff --git a/manual/arith.texi b/manual/arith.texi index 75d34c8427..282ca45e08 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -1968,6 +1968,20 @@ increasing payload; positive quiet NaNs, in order of increasing payload. @end deftypefun +@comment math.h +@comment ISO +@deftypefun int totalordermag (double @var{x}, double @var{y}) +@comment ISO +@deftypefunx int totalordermagf (float @var{x}, float @var{y}) +@comment ISO +@deftypefunx int totalordermagl (long double @var{x}, long double @var{y}) +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} +These functions determine whether the total order relationship, +defined in IEEE 754-2008, is true for the absolute values of @var{x} +and @var{y}, returning nonzero if it is true and zero if it is false. +No exceptions are raised even for signaling NaNs. +@end deftypefun + Not all machines provide hardware support for these operations. On machines that don't, the macros can be very slow. Therefore, you should not use these functions when NaN is not a concern. diff --git a/manual/libm-err-tab.pl b/manual/libm-err-tab.pl index 9989605e5b..102ff7b03a 100755 --- a/manual/libm-err-tab.pl +++ b/manual/libm-err-tab.pl @@ -79,7 +79,8 @@ use vars qw (%results @all_floats %suffices @all_functions); "trunc", "y0", "y1", "yn" ); # fpclassify, iscanonical, isnormal, isfinite, isinf, isnan, issignaling, # issubnormal, iszero, signbit, iseqsig, isgreater, isgreaterequal, isless, -# islessequal, islessgreater, isunordered, totalorder are not tabulated. +# islessequal, islessgreater, isunordered, totalorder, totalordermag +# are not tabulated. if ($#ARGV == 0) { $sources = $ARGV[0]; diff --git a/math/Makefile b/math/Makefile index ffaeb7c958..7c378fc5c3 100644 --- a/math/Makefile +++ b/math/Makefile @@ -72,7 +72,7 @@ libm-calls = \ s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F \ s_issignalingF $(calls:s_%=m_%) x2y2m1F \ gamma_productF lgamma_negF lgamma_productF \ - s_nextupF s_totalorderF $(gen-libm-calls) + s_nextupF s_totalorderF s_totalordermagF $(gen-libm-calls) libm-compat-calls-ldouble-yes = w_lgamma_compatl k_standardl libm-compat-calls = w_lgamma_compatf w_lgamma_compat k_standard k_standardf \ diff --git a/math/Versions b/math/Versions index 29246de94a..67e826a40e 100644 --- a/math/Versions +++ b/math/Versions @@ -218,5 +218,6 @@ libm { fesetexcept; fetestexceptflag; fegetmode; fesetmode; __iscanonicall; __iseqsigf; __iseqsig; __iseqsigl; totalorder; totalorderf; totalorderl; + totalordermag; totalordermagf; totalordermagl; } } diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h index c800c2d27d..030130656c 100644 --- a/math/bits/mathcalls.h +++ b/math/bits/mathcalls.h @@ -390,6 +390,10 @@ __MATHDECL_1 (int, __issignaling,, (_Mdouble_ __value)) /* Total order operation. */ __MATHDECL_1 (int, totalorder,, (_Mdouble_ __x, _Mdouble_ __y)) __attribute__ ((__const__)); + +/* Total order operation on absolute values. */ +__MATHDECL_1 (int, totalordermag,, (_Mdouble_ __x, _Mdouble_ __y)) + __attribute__ ((__const__)); #endif #if defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ diff --git a/math/libm-test.inc b/math/libm-test.inc index 4ad0938ff7..91451bfa99 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -54,7 +54,7 @@ pow, pow10, remainder, remquo, rint, lrint, llrint, round, lround, llround, scalb, scalbn, scalbln, signbit, sin, sincos, sinh, sqrt, - tan, tanh, tgamma, totalorder, trunc, + tan, tanh, tgamma, totalorder, totalordermag, trunc, y0, y1, yn, significand and for the following complex math functions: @@ -12517,6 +12517,254 @@ totalorder_test (void) } +static const struct test_ff_i_data totalordermag_test_data[] = + { + TEST_ff_b (totalordermag, minus_zero, minus_zero, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), + TEST_ff_b (totalordermag, minus_zero, plus_zero, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), + TEST_ff_b (totalordermag, minus_zero, 1, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), + TEST_ff_b (totalordermag, minus_zero, minus_infty, 1, |
