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 /manual | |
parent | 353683a22ed8a493a6bd1d78d63e144bc3e85d2f (diff) | |
download | glibc-525f803984f278e65dc07ca1156bdeca63755810.tar.gz |
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 'manual')
-rw-r--r-- | manual/arith.texi | 32 | ||||
-rwxr-xr-x | manual/libm-err-tab.pl | 2 |
2 files changed, 33 insertions, 1 deletions
diff --git a/manual/arith.texi b/manual/arith.texi index a20a4dec6c..f90ef26c91 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -2157,6 +2157,38 @@ are NaN, NaN is returned. @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}) @comment math.h @comment ISO diff --git a/manual/libm-err-tab.pl b/manual/libm-err-tab.pl index 0e83853949..cc51f0b82f 100755 --- a/manual/libm-err-tab.pl +++ b/manual/libm-err-tab.pl @@ -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", |