about summary refs log tree commit diff
path: root/manual
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2016-09-23 21:54:21 +0000
committerJoseph Myers <joseph@codesourcery.com>2016-09-23 21:54:21 +0000
commitbb8081f57f23a3e1b28b1b7104f24d17da9a3d82 (patch)
tree0987589e19a174ecc1550dfc366813e6102973ef /manual
parent4775578486c8ee2aa09b402eb272eb932e7e0691 (diff)
downloadglibc-bb8081f57f23a3e1b28b1b7104f24d17da9a3d82.tar.gz
glibc-bb8081f57f23a3e1b28b1b7104f24d17da9a3d82.tar.xz
glibc-bb8081f57f23a3e1b28b1b7104f24d17da9a3d82.zip
Add iszero.
TS 18661-1 adds an iszero classification macro to <math.h>.  This
patch implements it for glibc.  There are no new underlying functions
in libm because the implementation uses fpclassify when sNaN support
is required and a direct comparison otherwise; any optimizations for
this macro should be done through adding __builtin_iszero in GCC and
using it in the header for suitable GCC versions, not through adding
other optimized inline or out-of-line versions to glibc.

Tested for x86_64 and x86.

	* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (iszero): New
	macro.
	* math/libm-test.inc (iszero_test_data): New array.
	(iszero_test): New function.
	(main): Call iszero_test.
	* manual/arith.texi (Floating Point Classes): Document iszero.
	* manual/libm-err-tab.pl: Update comment on interfaces without
	ulps tabulated.
Diffstat (limited to 'manual')
-rw-r--r--manual/arith.texi8
-rwxr-xr-xmanual/libm-err-tab.pl2
2 files changed, 9 insertions, 1 deletions
diff --git a/manual/arith.texi b/manual/arith.texi
index bfa236a50e..58f35781bb 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -414,6 +414,14 @@ This macro returns a nonzero value if @var{x} is subnormal.  It is
 from TS 18661-1:2014.
 @end deftypefn
 
+@comment math.h
+@comment ISO
+@deftypefn {Macro} int iszero (@emph{float-type} @var{x})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This macro returns a nonzero value if @var{x} is zero.  It is from TS
+18661-1:2014.
+@end deftypefn
+
 Another set of floating-point classification functions was provided by
 BSD.  @Theglibc{} also supports these functions; however, we
 recommend that you use the ISO C99 macros in new code.  Those are standard
diff --git a/manual/libm-err-tab.pl b/manual/libm-err-tab.pl
index adeadb8f55..2386772b85 100755
--- a/manual/libm-err-tab.pl
+++ b/manual/libm-err-tab.pl
@@ -78,7 +78,7 @@ use vars qw (%results @all_floats %suffices @all_functions);
     "scalbn", "sin", "sincos", "sinh", "sqrt", "tan", "tanh", "tgamma",
     "trunc", "y0", "y1", "yn" );
 # fpclassify, isnormal, isfinite, isinf, isnan, issignaling,
-# issubnormal, signbit, isgreater, isgreaterequal, isless,
+# issubnormal, iszero, signbit, isgreater, isgreaterequal, isless,
 # islessequal, islessgreater, isunordered are not tabulated.
 
 if ($#ARGV == 0) {