mirror of git://sourceware.org/git/glibc.git
Add issubnormal.
TS 18661-1 adds an issubnormal classification macro to <math.h>. This patch implements it for glibc. There are no new underlying functions in libm because the implementation uses fpclassify; any optimizations for this macro should be done through adding __builtin_subnormal 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. The intended structure of the NEWS entry for <math.h> features from TS 18661-1 is like: * New <math.h> features are added from TS 18661-1:2014: - Nearest integer functions: roundeven, roundevenf, roundevenl. - Comparison macros: iseqsig. - Classification macros: iscanonical, issubnormal, iszero. (that is, following the grouping of interfaces in TS 18661-1:2014, with any group where any interfaces are new in glibc 2.25 being listed like that). Tested for x86_64 and x86. * math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (issubnormal): New macro. * math/libm-test.inc (issubnormal_test_data): New array. (issubnormal_test): New function. * manual/arith.texi (Floating Point Classes): Document issubnormal. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated.
This commit is contained in:
parent
5b17fd0da6
commit
d942e95cd7
|
@ -1,5 +1,14 @@
|
||||||
2016-09-21 Joseph Myers <joseph@codesourcery.com>
|
2016-09-21 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (issubnormal): New
|
||||||
|
macro.
|
||||||
|
* math/libm-test.inc (issubnormal_test_data): New array.
|
||||||
|
(issubnormal_test): New function.
|
||||||
|
* manual/arith.texi (Floating Point Classes): Document
|
||||||
|
issubnormal.
|
||||||
|
* manual/libm-err-tab.pl: Update comment on interfaces without
|
||||||
|
ulps tabulated.
|
||||||
|
|
||||||
* sysdeps/generic/stdint.h: Define
|
* sysdeps/generic/stdint.h: Define
|
||||||
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
|
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
|
||||||
<bits/libc-header-start.h> instead of including <features.h>.
|
<bits/libc-header-start.h> instead of including <features.h>.
|
||||||
|
|
4
NEWS
4
NEWS
|
@ -49,6 +49,10 @@ Version 2.25
|
||||||
UINTMAX_WIDTH, PTRDIFF_WIDTH, SIG_ATOMIC_WIDTH, SIZE_WIDTH, WCHAR_WIDTH,
|
UINTMAX_WIDTH, PTRDIFF_WIDTH, SIG_ATOMIC_WIDTH, SIZE_WIDTH, WCHAR_WIDTH,
|
||||||
WINT_WIDTH.
|
WINT_WIDTH.
|
||||||
|
|
||||||
|
* New <math.h> features are added from TS 18661-1:2014:
|
||||||
|
|
||||||
|
- Classification macros: issubnormal.
|
||||||
|
|
||||||
* The <sys/quota.h> header now includes the <linux/quota.h> header. Support
|
* 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
|
for the Linux quota interface which predates kernel version 2.4.22 has
|
||||||
been removed.
|
been removed.
|
||||||
|
|
|
@ -406,6 +406,14 @@ This macro returns a nonzero value if @var{x} is a signaling NaN
|
||||||
(sNaN). It is from TS 18661-1:2014.
|
(sNaN). It is from TS 18661-1:2014.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@comment math.h
|
||||||
|
@comment ISO
|
||||||
|
@deftypefn {Macro} int issubnormal (@emph{float-type} @var{x})
|
||||||
|
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
|
||||||
|
This macro returns a nonzero value if @var{x} is subnormal. It is
|
||||||
|
from TS 18661-1:2014.
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
Another set of floating-point classification functions was provided by
|
Another set of floating-point classification functions was provided by
|
||||||
BSD. @Theglibc{} also supports these functions; however, we
|
BSD. @Theglibc{} also supports these functions; however, we
|
||||||
recommend that you use the ISO C99 macros in new code. Those are standard
|
recommend that you use the ISO C99 macros in new code. Those are standard
|
||||||
|
|
|
@ -77,9 +77,9 @@ use vars qw (%results @all_floats %suffices @all_functions);
|
||||||
"nextup", "pow", "remainder", "remquo", "rint", "round", "scalb",
|
"nextup", "pow", "remainder", "remquo", "rint", "round", "scalb",
|
||||||
"scalbn", "sin", "sincos", "sinh", "sqrt", "tan", "tanh", "tgamma",
|
"scalbn", "sin", "sincos", "sinh", "sqrt", "tan", "tanh", "tgamma",
|
||||||
"trunc", "y0", "y1", "yn" );
|
"trunc", "y0", "y1", "yn" );
|
||||||
# fpclassify, isnormal, isfinite, isinf, isnan, issignaling, signbit,
|
# fpclassify, isnormal, isfinite, isinf, isnan, issignaling,
|
||||||
# isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered
|
# issubnormal, signbit, isgreater, isgreaterequal, isless,
|
||||||
# are not tabulated.
|
# islessequal, islessgreater, isunordered are not tabulated.
|
||||||
|
|
||||||
if ($#ARGV == 0) {
|
if ($#ARGV == 0) {
|
||||||
$sources = $ARGV[0];
|
$sources = $ARGV[0];
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
cbrt, ceil, copysign, cos, cosh, drem, erf, erfc, exp, exp10, exp2, expm1,
|
cbrt, ceil, copysign, cos, cosh, drem, erf, erfc, exp, exp10, exp2, expm1,
|
||||||
fabs, fdim, finite, floor, fma, fmax, fmin, fmod, fpclassify,
|
fabs, fdim, finite, floor, fma, fmax, fmin, fmod, fpclassify,
|
||||||
frexp, gamma, hypot,
|
frexp, gamma, hypot,
|
||||||
ilogb, isfinite, isinf, isnan, isnormal, issignaling,
|
ilogb, isfinite, isinf, isnan, isnormal, issignaling, issubnormal,
|
||||||
isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
|
isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
|
||||||
j0, j1, jn,
|
j0, j1, jn,
|
||||||
ldexp, lgamma, log, log10, log1p, log2, logb,
|
ldexp, lgamma, log, log10, log1p, log2, logb,
|
||||||
|
@ -8587,6 +8587,31 @@ issignaling_test (void)
|
||||||
ALL_RM_TEST (issignaling, 1, issignaling_test_data, RUN_TEST_LOOP_f_b_tg, END);
|
ALL_RM_TEST (issignaling, 1, issignaling_test_data, RUN_TEST_LOOP_f_b_tg, END);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct test_f_i_data issubnormal_test_data[] =
|
||||||
|
{
|
||||||
|
TEST_f_b (issubnormal, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, minus_zero, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, 10, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, min_subnorm_value, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, -min_subnorm_value, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, min_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, -min_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, max_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, -max_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, plus_infty, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, minus_infty, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
TEST_f_b (issubnormal, -snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
issubnormal_test (void)
|
||||||
|
{
|
||||||
|
ALL_RM_TEST (issubnormal, 1, issubnormal_test_data, RUN_TEST_LOOP_f_b_tg, END);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct test_ff_i_data isunordered_test_data[] =
|
static const struct test_ff_i_data isunordered_test_data[] =
|
||||||
{
|
{
|
||||||
TEST_ff_i (isunordered, minus_zero, minus_zero, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
TEST_ff_i (isunordered, minus_zero, minus_zero, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
||||||
|
@ -12668,6 +12693,7 @@ main (int argc, char **argv)
|
||||||
isnan_test ();
|
isnan_test ();
|
||||||
isnormal_test ();
|
isnormal_test ();
|
||||||
issignaling_test ();
|
issignaling_test ();
|
||||||
|
issubnormal_test ();
|
||||||
signbit_test ();
|
signbit_test ();
|
||||||
|
|
||||||
/* Trigonometric functions: */
|
/* Trigonometric functions: */
|
||||||
|
|
|
@ -328,6 +328,9 @@ enum
|
||||||
: sizeof (x) == sizeof (double) \
|
: sizeof (x) == sizeof (double) \
|
||||||
? __issignaling (x) : __issignalingl (x))
|
? __issignaling (x) : __issignalingl (x))
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
/* Return nonzero value if X is subnormal. */
|
||||||
|
# define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL)
|
||||||
#endif /* Use IEC_60559_BFP_EXT. */
|
#endif /* Use IEC_60559_BFP_EXT. */
|
||||||
|
|
||||||
#ifdef __USE_MISC
|
#ifdef __USE_MISC
|
||||||
|
|
Loading…
Reference in New Issue