diff options
author | Joseph Myers <joseph@codesourcery.com> | 2016-11-24 23:56:48 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2016-11-24 23:56:48 +0000 |
commit | 457663a7cd48a675b44769368567713353011b5b (patch) | |
tree | 4957e1ec4a3de87e4bf4ee51567e9090f0049e91 /manual | |
parent | 02c78f02a941461efa566fed8a0209592b0943fc (diff) | |
download | glibc-457663a7cd48a675b44769368567713353011b5b.tar glibc-457663a7cd48a675b44769368567713353011b5b.tar.gz glibc-457663a7cd48a675b44769368567713353011b5b.tar.bz2 glibc-457663a7cd48a675b44769368567713353011b5b.zip |
Add setpayloadsig, setpayloadsigf, setpayloadsigl.
TS 18661-1 defines functions for manipulating the payloads of NaNs.
This patch implements the setpayloadsig functions for glibc; these are
like the setpayload functions, but produce a signaling NaN instead of
a quiet NaN.
The substance of the implementation was included with the setpayload
implementation, so the new files here just need to wrap the main files
with different defines to build the new functions.
Because the functions store a signaling NaN via a pointer and the
libm-test macros choose a suitable initial value for the variable in
such a case by comparing with the expected value, the relevant macro
needs to clear exceptions after FE_INVALID may have been raised by
that comparison.
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(setpayloadsig): New declaration.
* math/Versions (setpayloadsig): New libm symbol at version
GLIBC_2.25.
(setpayloadsigf): Likewise.
(setpayloadsigl): Likewise.
* math/Makefile (libm-calls): Add s_setpayloadsigF.
* math/libm-test.inc (RUN_TEST_Ff_b1): Call feclearexcept
(FE_ALL_EXCEPT) after initializing EXTRA_VAR.
(setpayloadsig_test_data): New array.
(setpayloadsig_test): New function.
(main): Call setpayloadsig_test.
* manual/arith.texi (FP Bit Twiddling): Document setpayloadsig,
setpayloadsigf and setpayloadsigl.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/dbl-64/s_setpayloadsig.c: New file.
* sysdeps/ieee754/flt-32/s_setpayloadsigf.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-setpayloadsig.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
setpayloadsig.
(CFLAGS-nldbl-setpayloadsig.c): New variable.
* 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 | 18 | ||||
-rwxr-xr-x | manual/libm-err-tab.pl | 3 |
2 files changed, 20 insertions, 1 deletions
diff --git a/manual/arith.texi b/manual/arith.texi index 07dd733844..f9296a362e 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -1932,6 +1932,24 @@ object pointed to by @var{x} is set to positive zero and a nonzero value is returned. They raise no floating-point exceptions. @end deftypefun +@comment math.h +@comment ISO +@deftypefun int setpayloadsig (double *@var{x}, double @var{payload}) +@comment math.h +@comment ISO +@deftypefunx int setpayloadsigf (float *@var{x}, float @var{payload}) +@comment math.h +@comment ISO +@deftypefunx int setpayloadsigl (long double *@var{x}, long double @var{payload}) +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} +These functions, defined by TS 18661-1:2014, set the object pointed to +by @var{x} to a signaling NaN with payload @var{payload} and a zero +sign bit and return zero. If @var{payload} is not a positive-signed +integer that is a valid payload for a signaling NaN of the given type, +the object pointed to by @var{x} is set to positive zero and a nonzero +value is returned. They raise no floating-point exceptions. +@end deftypefun + @node FP Comparison Functions @subsection Floating-Point Comparison Functions @cindex unordered comparison diff --git a/manual/libm-err-tab.pl b/manual/libm-err-tab.pl index 146460675f..6d0bffc372 100755 --- a/manual/libm-err-tab.pl +++ b/manual/libm-err-tab.pl @@ -67,7 +67,8 @@ use vars qw (%results @all_floats %suffices @all_functions); # canonicalize, fpclassify, getpayload, iscanonical, isnormal, # isfinite, isinf, isnan, issignaling, issubnormal, iszero, signbit, # iseqsig, isgreater, isgreaterequal, isless, islessequal, -# islessgreater, isunordered, setpayload, totalorder, totalordermag +# islessgreater, isunordered, setpayload, setpayloadsig, +# totalorder, totalordermag # are not tabulated. if ($#ARGV == 0) { |