mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-02 17:50:20 +00:00
b4e75104b4
This patch refactors some type-generic libm macros, in both math.h and math_private.h, to be based on a common __MATH_TG macro rather than all replicating similar logic to choose a function to call based on the type of the argument. This should serve to illustrate what I think float128 support for such macros should look like: common macros such as __MATH_TG may need different definitions depending on whether float128 is supported in glibc, so that the individual macros themselves do not need conditionals on float128 support. Tested for x86_64, x86, mips64 and powerpc. * math/math.h (__MATH_TG): New macro. [__USE_ISOC99] (fpclassify): Define using __MATH_TG. [__USE_ISOC99] (signbit): Likewise. [__USE_ISOC99] (isfinite): Likewise. [__USE_ISOC99] (isnan): Likewise. [__USE_ISOC99] (isinf): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (issignaling): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (__MATH_EVAL_FMT2): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (iseqsig): Define using __MATH_TG and __MATH_EVAL_FMT2. * sysdeps/generic/math_private.h (fabs_tg): Define using __MATH_TG. * sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h [!__NO_LONG_DOUBLE_MATH] (__iscanonicalf): New macro. [!__NO_LONG_DOUBLE_MATH] (__iscanonical): Likewise. [!__NO_LONG_DOUBLE_MATH] (iscanonical): Define using __MATH_TG. * sysdeps/ieee754/ldbl-96/bits/iscanonical.h (__iscanonicalf): New macro. (__iscanonical): Likewise. (iscanonical): Define using __MATH_TG.
39 lines
1.7 KiB
C
39 lines
1.7 KiB
C
/* Define iscanonical macro. ldbl-128ibm version.
|
|
Copyright (C) 2016 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef _MATH_H
|
|
# error "Never use <bits/iscanonical.h> directly; include <math.h> instead."
|
|
#endif
|
|
|
|
#ifdef __NO_LONG_DOUBLE_MATH
|
|
# define iscanonical(x) ((void) (__typeof (x)) (x), 1)
|
|
#else
|
|
extern int __iscanonicall (long double __x)
|
|
__THROW __attribute__ ((__const__));
|
|
# define __iscanonicalf(x) ((void) (__typeof (x)) (x), 1)
|
|
# define __iscanonical(x) ((void) (__typeof (x)) (x), 1)
|
|
|
|
/* Return nonzero value if X is canonical. In IEEE interchange binary
|
|
formats, all values are canonical, but the argument must still be
|
|
converted to its semantic type for any exceptions arising from the
|
|
conversion, before being discarded; in IBM long double, there are
|
|
encodings that are not consistently handled as corresponding to any
|
|
particular value of the type, and we return 0 for those. */
|
|
# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x))
|
|
#endif
|