summaryrefslogtreecommitdiff
path: root/math/bits
diff options
context:
space:
mode:
Diffstat (limited to 'math/bits')
-rw-r--r--math/bits/cmathcalls.h36
-rw-r--r--math/bits/math-finite.h473
-rw-r--r--math/bits/mathcalls-helper-functions.h43
-rw-r--r--math/bits/mathcalls-narrow.h33
-rw-r--r--math/bits/mathcalls.h153
5 files changed, 245 insertions, 493 deletions
diff --git a/math/bits/cmathcalls.h b/math/bits/cmathcalls.h
index e02707e603..e22b804942 100644
--- a/math/bits/cmathcalls.h
+++ b/math/bits/cmathcalls.h
@@ -1,6 +1,6 @@
/* Prototype declarations for complex math functions;
helper file for <complex.h>.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 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
@@ -44,7 +44,9 @@
#error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead."
#endif
-#define _Mdouble_complex_ _Mdouble_ _Complex
+#ifndef _Mdouble_complex_
+# define _Mdouble_complex_ _Mdouble_ _Complex
+#endif
/* Trigonometric functions. */
@@ -126,33 +128,3 @@ __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
/* Real part of Z. */
__MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
-
-
-/* Now some optimized versions. GCC has handy notations for these
- functions. Recent GCC handles these as builtin functions so does
- not need inlines. */
-#if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ \
- && defined __extern_inline
-
-/* Imaginary part of Z. */
-__extern_inline _Mdouble_
-__MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW
-{
- return __imag__ __z;
-}
-
-/* Real part of Z. */
-__extern_inline _Mdouble_
-__MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW
-{
- return __real__ __z;
-}
-
-/* Complex conjugate of Z. */
-__extern_inline _Mdouble_complex_
-__MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW
-{
- return __extension__ ~__z;
-}
-
-#endif
diff --git a/math/bits/math-finite.h b/math/bits/math-finite.h
index adaad0e4e4..0799fe7b29 100644
--- a/math/bits/math-finite.h
+++ b/math/bits/math-finite.h
@@ -1,5 +1,5 @@
/* Entry points to finite-math-only compiler runs.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
+ Copyright (C) 2011-2018 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
@@ -20,487 +20,178 @@
# error "Never use <bits/math-finite.h> directly; include <math.h> instead."
#endif
+#define __REDIRFROM(...) __REDIRFROM_X(__VA_ARGS__)
+
+#define __REDIRTO(...) __REDIRTO_X(__VA_ARGS__)
+
+#define __MATH_REDIRCALL_X(from, args, to) \
+ extern _Mdouble_ __REDIRECT_NTH (from, args, to)
+#define __MATH_REDIRCALL(function, reentrant, args) \
+ __MATH_REDIRCALL_X \
+ (__REDIRFROM (function, reentrant), args, \
+ __REDIRTO (function, reentrant))
+#define __MATH_REDIRCALL_2(from, reentrant, args, to) \
+ __MATH_REDIRCALL_X \
+ (__REDIRFROM (from, reentrant), args, \
+ __REDIRTO (to, reentrant))
+
+#define __MATH_REDIRCALL_INTERNAL(function, reentrant, args) \
+ __MATH_REDIRCALL_X \
+ (__REDIRFROM (__CONCAT (__, function), \
+ __CONCAT (reentrant, _finite)), \
+ args, __REDIRTO (function, _r))
+
+
/* acos. */
-extern double __REDIRECT_NTH (acos, (double), __acos_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (acosf, (float), __acosf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (acosl, (long double), __acos_finite);
-# else
-extern long double __REDIRECT_NTH (acosl, (long double), __acosl_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (acos, , (_Mdouble_));
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
/* acosh. */
-extern double __REDIRECT_NTH (acosh, (double), __acosh_finite);
-#endif
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (acoshf, (float), __acoshf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (acoshl, (long double), __acosh_finite);
-# else
-extern long double __REDIRECT_NTH (acoshl, (long double), __acoshl_finite);
-# endif
-# endif
+__MATH_REDIRCALL (acosh, , (_Mdouble_));
#endif
/* asin. */
-extern double __REDIRECT_NTH (asin, (double), __asin_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (asinf, (float), __asinf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (asinl, (long double), __asin_finite);
-# else
-extern long double __REDIRECT_NTH (asinl, (long double), __asinl_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (asin, , (_Mdouble_));
/* atan2. */
-extern double __REDIRECT_NTH (atan2, (double, double), __atan2_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (atan2f, (float, float), __atan2f_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (atan2l, (long double, long double),
- __atan2_finite);
-# else
-extern long double __REDIRECT_NTH (atan2l, (long double, long double),
- __atan2l_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (atan2, , (_Mdouble_, _Mdouble_));
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
/* atanh. */
-extern double __REDIRECT_NTH (atanh, (double), __atanh_finite);
-#endif
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (atanhf, (float), __atanhf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (atanhl, (long double), __atanh_finite);
-# else
-extern long double __REDIRECT_NTH (atanhl, (long double), __atanhl_finite);
-# endif
-# endif
+__MATH_REDIRCALL (atanh, , (_Mdouble_));
#endif
/* cosh. */
-extern double __REDIRECT_NTH (cosh, (double), __cosh_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (coshf, (float), __coshf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (coshl, (long double), __cosh_finite);
-# else
-extern long double __REDIRECT_NTH (coshl, (long double), __coshl_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (cosh, , (_Mdouble_));
/* exp. */
-extern double __REDIRECT_NTH (exp, (double), __exp_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (expf, (float), __expf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (expl, (long double), __exp_finite);
-# else
-extern long double __REDIRECT_NTH (expl, (long double), __expl_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (exp, , (_Mdouble_));
-#ifdef __USE_GNU
+#if __GLIBC_USE (IEC_60559_FUNCS_EXT)
/* exp10. */
-extern double __REDIRECT_NTH (exp10, (double), __exp10_finite);
-extern float __REDIRECT_NTH (exp10f, (float), __exp10f_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (exp10l, (long double), __exp10_finite);
-# else
-extern long double __REDIRECT_NTH (exp10l, (long double), __exp10l_finite);
-# endif
-# endif
-
-/* pow10. */
-extern double __REDIRECT_NTH (pow10, (double), __exp10_finite);
-extern float __REDIRECT_NTH (pow10f, (float), __exp10f_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (pow10l, (long double), __exp10_finite);
-# else
-extern long double __REDIRECT_NTH (pow10l, (long double), __exp10l_finite);
-# endif
-# endif
+__MATH_REDIRCALL (exp10, , (_Mdouble_));
#endif
#ifdef __USE_ISOC99
/* exp2. */
-extern double __REDIRECT_NTH (exp2, (double), __exp2_finite);
-extern float __REDIRECT_NTH (exp2f, (float), __exp2f_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (exp2l, (long double), __exp2_finite);
-# else
-extern long double __REDIRECT_NTH (exp2l, (long double), __exp2l_finite);
-# endif
-# endif
+__MATH_REDIRCALL (exp2, , (_Mdouble_));
#endif
/* fmod. */
-extern double __REDIRECT_NTH (fmod, (double, double), __fmod_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (fmodf, (float, float), __fmodf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (fmodl, (long double, long double),
- __fmod_finite);
-# else
-extern long double __REDIRECT_NTH (fmodl, (long double, long double),
- __fmodl_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (fmod, , (_Mdouble_, _Mdouble_));
#if defined __USE_XOPEN || defined __USE_ISOC99
/* hypot. */
-extern double __REDIRECT_NTH (hypot, (double, double), __hypot_finite);
-#endif
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (hypotf, (float, float), __hypotf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (hypotl, (long double, long double),
- __hypot_finite);
-# else
-extern long double __REDIRECT_NTH (hypotl, (long double, long double),
- __hypotl_finite);
-# endif
-# endif
+__MATH_REDIRCALL (hypot, , (_Mdouble_, _Mdouble_));
#endif
-#if defined __USE_MISC || defined __USE_XOPEN
+#if (__MATH_DECLARING_DOUBLE && (defined __USE_MISC || defined __USE_XOPEN)) \
+ || (!__MATH_DECLARING_DOUBLE && defined __USE_MISC)
/* j0. */
-extern double __REDIRECT_NTH (j0, (double), __j0_finite);
-#endif
-#if defined __USE_MISC && defined __USE_ISOC99
-extern float __REDIRECT_NTH (j0f, (float), __j0f_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (j0l, (long double), __j0_finite);
-# else
-extern long double __REDIRECT_NTH (j0l, (long double), __j0l_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (j0, , (_Mdouble_));
-#if defined __USE_MISC || defined __USE_XOPEN
/* y0. */
-extern double __REDIRECT_NTH (y0, (double), __y0_finite);
-#endif
-#if defined __USE_MISC && defined __USE_ISOC99
-extern float __REDIRECT_NTH (y0f, (float), __y0f_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (y0l, (long double), __y0_finite);
-# else
-extern long double __REDIRECT_NTH (y0l, (long double), __y0l_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (y0, , (_Mdouble_));
-#if defined __USE_MISC || defined __USE_XOPEN
/* j1. */
-extern double __REDIRECT_NTH (j1, (double), __j1_finite);
-#endif
-#if defined __USE_MISC && defined __USE_ISOC99
-extern float __REDIRECT_NTH (j1f, (float), __j1f_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (j1l, (long double), __j1_finite);
-# else
-extern long double __REDIRECT_NTH (j1l, (long double), __j1l_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (j1, , (_Mdouble_));
-#if defined __USE_MISC || defined __USE_XOPEN
/* y1. */
-extern double __REDIRECT_NTH (y1, (double), __y1_finite);
-#endif
-#if defined __USE_MISC && defined __USE_ISOC99
-extern float __REDIRECT_NTH (y1f, (float), __y1f_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (y1l, (long double), __y1_finite);
-# else
-extern long double __REDIRECT_NTH (y1l, (long double), __y1l_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (y1, , (_Mdouble_));
-#if defined __USE_MISC || defined __USE_XOPEN
/* jn. */
-extern double __REDIRECT_NTH (jn, (int, double), __jn_finite);
-#endif
-#if defined __USE_MISC && defined __USE_ISOC99
-extern float __REDIRECT_NTH (jnf, (int, float), __jnf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (jnl, (int, long double), __jn_finite);
-# else
-extern long double __REDIRECT_NTH (jnl, (int, long double), __jnl_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (jn, , (int, _Mdouble_));
-#if defined __USE_MISC || defined __USE_XOPEN
/* yn. */
-extern double __REDIRECT_NTH (yn, (int, double), __yn_finite);
-#endif
-#if defined __USE_MISC && defined __USE_ISOC99
-extern float __REDIRECT_NTH (ynf, (int, float), __ynf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (ynl, (int, long double), __yn_finite);
-# else
-extern long double __REDIRECT_NTH (ynl, (int, long double), __ynl_finite);
-# endif
-# endif
+__MATH_REDIRCALL (yn, , (int, _Mdouble_));
#endif
#ifdef __USE_MISC
/* lgamma_r. */
-extern double __REDIRECT_NTH (lgamma_r, (double, int *), __lgamma_r_finite);
-# ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (lgammaf_r, (float, int *), __lgammaf_r_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (lgammal_r, (long double, int *),
- __lgamma_r_finite);
-# else
-extern long double __REDIRECT_NTH (lgammal_r, (long double, int *),
- __lgammal_r_finite);
-# endif
-# endif
-# endif
+__MATH_REDIRCALL (lgamma, _r, (_Mdouble_, int *));
#endif
-extern double __lgamma_r_finite (double, int *);
-extern float __lgammaf_r_finite (float, int *);
-#ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (__lgammal_r_finite, (long double, int *),
- __lgamma_r_finite);
-#else
-extern long double __lgammal_r_finite (long double, int *);
-#endif
+/* Redirect __lgammal_r_finite to __lgamma_r_finite when __NO_LONG_DOUBLE_MATH
+ is set and to itself otherwise. It also redirects __lgamma_r_finite and
+ __lgammaf_r_finite to themselves. */
+__MATH_REDIRCALL_INTERNAL (lgamma, _r, (_Mdouble_, int *));
#if ((defined __USE_XOPEN || defined __USE_ISOC99) \
&& defined __extern_always_inline)
/* lgamma. */
-__extern_always_inline double __NTH (lgamma (double __d))
+__extern_always_inline _Mdouble_
+__NTH (__REDIRFROM (lgamma, ) (_Mdouble_ __d))
{
# if defined __USE_MISC || defined __USE_XOPEN
- return __lgamma_r_finite (__d, &signgam);
+ return __REDIRTO (lgamma, _r) (__d, &signgam);
# else
int __local_signgam = 0;
- return __lgamma_r_finite (__d, &__local_signgam);
+ return __REDIRTO (lgamma, _r) (__d, &__local_signgam);
# endif
}
#endif
-#if defined __USE_ISOC99 && defined __extern_always_inline
-__extern_always_inline float __NTH (lgammaf (float __d))
-{
-# if defined __USE_MISC || defined __USE_XOPEN
- return __lgammaf_r_finite (__d, &signgam);
-# else
- int __local_signgam = 0;
- return __lgammaf_r_finite (__d, &__local_signgam);
-# endif
-}
-# ifdef __MATH_DECLARE_LDOUBLE
-__extern_always_inline long double __NTH (lgammal (long double __d))
-{
-# if defined __USE_MISC || defined __USE_XOPEN
- return __lgammal_r_finite (__d, &signgam);
-# else
- int __local_signgam = 0;
- return __lgammal_r_finite (__d, &__local_signgam);
-# endif
-}
-# endif
-#endif
#if ((defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)) \
- && defined __extern_always_inline)
+ && defined __extern_always_inline) && !__MATH_DECLARING_FLOATN
/* gamma. */
-__extern_always_inline double __NTH (gamma (double __d))
-{
- return __lgamma_r_finite (__d, &signgam);
-}
-# ifdef __USE_ISOC99
-__extern_always_inline float __NTH (gammaf (float __d))
-{
- return __lgammaf_r_finite (__d, &signgam);
-}
-# ifdef __MATH_DECLARE_LDOUBLE
-__extern_always_inline long double __NTH (gammal (long double __d))
+__extern_always_inline _Mdouble_
+__NTH (__REDIRFROM (gamma, ) (_Mdouble_ __d))
{
- return __lgammal_r_finite (__d, &signgam);
+ return __REDIRTO (lgamma, _r) (__d, &signgam);
}
-# endif
-# endif
#endif
/* log. */
-extern double __REDIRECT_NTH (log, (double), __log_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (logf, (float), __logf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (logl, (long double), __log_finite);
-# else
-extern long double __REDIRECT_NTH (logl, (long double), __logl_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (log, , (_Mdouble_));
/* log10. */
-extern double __REDIRECT_NTH (log10, (double), __log10_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (log10f, (float), __log10f_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (log10l, (long double), __log10_finite);
-# else
-extern long double __REDIRECT_NTH (log10l, (long double), __log10l_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (log10, , (_Mdouble_));
#ifdef __USE_ISOC99
/* log2. */
-extern double __REDIRECT_NTH (log2, (double), __log2_finite);
-extern float __REDIRECT_NTH (log2f, (float), __log2f_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (log2l, (long double), __log2_finite);
-# else
-extern long double __REDIRECT_NTH (log2l, (long double), __log2l_finite);
-# endif
-# endif
+__MATH_REDIRCALL (log2, , (_Mdouble_));
#endif
/* pow. */
-extern double __REDIRECT_NTH (pow, (double, double), __pow_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (powf, (float, float), __powf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (powl, (long double, long double),
- __pow_finite);
-# else
-extern long double __REDIRECT_NTH (powl, (long double, long double),
- __powl_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (pow, , (_Mdouble_, _Mdouble_));
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
/* remainder. */
-extern double __REDIRECT_NTH (remainder, (double, double), __remainder_finite);
-#endif
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (remainderf, (float, float), __remainderf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (remainderl, (long double, long double),
- __remainder_finite);
-# else
-extern long double __REDIRECT_NTH (remainderl, (long double, long double),
- __remainderl_finite);
-# endif
-# endif
+__MATH_REDIRCALL (remainder, , (_Mdouble_, _Mdouble_));
#endif
-#if (defined __USE_MISC \
- || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8))
+#if ((__MATH_DECLARING_DOUBLE \
+ && (defined __USE_MISC \
+ || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8))) \
+ || (!defined __MATH_DECLARE_LDOUBLE && defined __USE_MISC)) \
+ && !__MATH_DECLARING_FLOATN
/* scalb. */
-extern double __REDIRECT_NTH (scalb, (double, double), __scalb_finite);
-#endif
-#if defined __USE_MISC && defined __USE_ISOC99
-extern float __REDIRECT_NTH (scalbf, (float, float), __scalbf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (scalbl, (long double, long double),
- __scalb_finite);
-# else
-extern long double __REDIRECT_NTH (scalbl, (long double, long double),
- __scalbl_finite);
-# endif
-# endif
+__MATH_REDIRCALL (scalb, , (_Mdouble_, _Mdouble_));
#endif
/* sinh. */
-extern double __REDIRECT_NTH (sinh, (double), __sinh_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (sinhf, (float), __sinhf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (sinhl, (long double), __sinh_finite);
-# else
-extern long double __REDIRECT_NTH (sinhl, (long double), __sinhl_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (sinh, , (_Mdouble_));
/* sqrt. */
-extern double __REDIRECT_NTH (sqrt, (double), __sqrt_finite);
-#ifdef __USE_ISOC99
-extern float __REDIRECT_NTH (sqrtf, (float), __sqrtf_finite);
-# ifdef __MATH_DECLARE_LDOUBLE
-# ifdef __NO_LONG_DOUBLE_MATH
-extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrt_finite);
-# else
-extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrtl_finite);
-# endif
-# endif
-#endif
+__MATH_REDIRCALL (sqrt, , (_Mdouble_));
#if defined __USE_ISOC99 && defined __extern_always_inline
/* tgamma. */
-extern double __gamma_r_finite (double, int *);
-__extern_always_inline double __NTH (tgamma (double __d))
-{
- int __local_signgam = 0;
- double __res = __gamma_r_finite (__d, &__local_signgam);
- return __local_signgam < 0 ? -__res : __res;
-}
-extern float __gammaf_r_finite (float, int *);
-__extern_always_inline float __NTH (tgammaf (float __d))
-{
- int __local_signgam = 0;
- float __res = __gammaf_r_finite (__d, &__local_signgam);
- return __local_signgam < 0 ? -__res : __res;
-}
-# ifdef __MATH_DECLARE_LDOUBLE
-extern long double __gammal_r_finite (long double, int *);
-__extern_always_inline long double __NTH (tgammal (long double __d))
+extern _Mdouble_
+__REDIRFROM (__gamma, _r_finite) (_Mdouble_, int *);
+
+__extern_always_inline _Mdouble_
+__NTH (__REDIRFROM (tgamma, ) (_Mdouble_ __d))
{
int __local_signgam = 0;
-# ifdef __NO_LONG_DOUBLE_MATH
- long double __res = __gamma_r_finite (__d, &__local_signgam);
-# else
- long double __res = __gammal_r_finite (__d, &__local_signgam);
-# endif
+ _Mdouble_ __res = __REDIRTO (gamma, _r) (__d, &__local_signgam);
return __local_signgam < 0 ? -__res : __res;
}
-# endif
#endif
+
+#undef __REDIRFROM
+#undef __REDIRTO
+#undef __MATH_REDIRCALL
+#undef __MATH_REDIRCALL_2
+#undef __MATH_REDIRCALL_INTERNAL
+#undef __MATH_REDIRCALL_X
diff --git a/math/bits/mathcalls-helper-functions.h b/math/bits/mathcalls-helper-functions.h
new file mode 100644
index 0000000000..ac3115bfdc
--- /dev/null
+++ b/math/bits/mathcalls-helper-functions.h
@@ -0,0 +1,43 @@
+/* Prototype declarations for math classification macros helpers.
+ Copyright (C) 2017-2018 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/>. */
+
+
+/* Classify given number. */
+__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value))
+ __attribute__ ((__const__));
+
+/* Test for negative number. */
+__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
+ __attribute__ ((__const__));
+
+/* Return 0 if VALUE is finite or NaN, +1 if it
+ is +Infinity, -1 if it is -Infinity. */
+__MATHDECL_1 (int, __isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
+
+/* Return nonzero if VALUE is finite and not NaN. Used by isfinite macro. */
+__MATHDECL_1 (int, __finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
+
+/* Return nonzero if VALUE is not a number. */
+__MATHDECL_1 (int, __isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
+
+/* Test equality. */
+__MATHDECL_1 (int, __iseqsig,, (_Mdouble_ __x, _Mdouble_ __y));
+
+/* Test for signaling NaN. */
+__MATHDECL_1 (int, __issignaling,, (_Mdouble_ __value))
+ __attribute__ ((__const__));
diff --git a/math/bits/mathcalls-narrow.h b/math/bits/mathcalls-narrow.h
new file mode 100644
index 0000000000..9d03d5f7f2
--- /dev/null
+++ b/math/bits/mathcalls-narrow.h
@@ -0,0 +1,33 @@
+/* Declare functions returning a narrower type.
+ Copyright (C) 2018 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 include <bits/mathcalls-narrow.h> directly; include <math.h> instead."
+#endif
+
+/* Add. */
+__MATHCALL_NARROW (__MATHCALL_NAME (add), __MATHCALL_REDIR_NAME (add), 2);
+
+/* Divide. */
+__MATHCALL_NARROW (__MATHCALL_NAME (div), __MATHCALL_REDIR_NAME (div), 2);
+
+/* Multiply. */
+__MATHCALL_NARROW (__MATHCALL_NAME (mul), __MATHCALL_REDIR_NAME (mul), 2);
+
+/* Subtract. */
+__MATHCALL_NARROW (__MATHCALL_NAME (sub), __MATHCALL_REDIR_NAME (sub), 2);
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index 9a7b3f0f18..cf87313e2f 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -1,5 +1,5 @@
/* Prototype declarations for math functions; helper file for <math.h>.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 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
@@ -49,7 +49,6 @@
/* Trigonometric functions. */
-_Mdouble_BEGIN_NAMESPACE
/* Arc cosine of X. */
__MATHCALL (acos,, (_Mdouble_ __x));
/* Arc sine of X. */
@@ -74,7 +73,6 @@ __MATHCALL (cosh,, (_Mdouble_ __x));
__MATHCALL (sinh,, (_Mdouble_ __x));
/* Hyperbolic tangent of X. */
__MATHCALL (tanh,, (_Mdouble_ __x));
-_Mdouble_END_NAMESPACE
#ifdef __USE_GNU
/* Cosine and sine of X. */
@@ -83,19 +81,16 @@ __MATHDECL_VEC (void,sincos,,
#endif
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
/* Hyperbolic arc cosine of X. */
__MATHCALL (acosh,, (_Mdouble_ __x));
/* Hyperbolic arc sine of X. */
__MATHCALL (asinh,, (_Mdouble_ __x));
/* Hyperbolic arc tangent of X. */
__MATHCALL (atanh,, (_Mdouble_ __x));
-__END_NAMESPACE_C99
#endif
/* Exponential and logarithmic functions. */
-_Mdouble_BEGIN_NAMESPACE
/* Exponential function of X. */
__MATHCALL_VEC (exp,, (_Mdouble_ __x));
@@ -113,17 +108,13 @@ __MATHCALL (log10,, (_Mdouble_ __x));
/* Break VALUE into integral and fractional parts. */
__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2));
-_Mdouble_END_NAMESPACE
-#ifdef __USE_GNU
-/* A function missing in all standards: compute exponent to base ten. */
+#if __GLIBC_USE (IEC_60559_FUNCS_EXT)
+/* Compute exponent to base ten. */
__MATHCALL (exp10,, (_Mdouble_ __x));
-/* Another name occasionally used. */
-__MATHCALL (pow10,, (_Mdouble_ __x));
#endif
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
/* Return exp(X) - 1. */
__MATHCALL (expm1,, (_Mdouble_ __x));
@@ -132,48 +123,38 @@ __MATHCALL (log1p,, (_Mdouble_ __x));
/* Return the base 2 signed integral exponent of X. */
__MATHCALL (logb,, (_Mdouble_ __x));
-__END_NAMESPACE_C99
#endif
#ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
/* Compute base-2 exponential of X. */
__MATHCALL (exp2,, (_Mdouble_ __x));
/* Compute base-2 logarithm of X. */
__MATHCALL (log2,, (_Mdouble_ __x));
-__END_NAMESPACE_C99
#endif
/* Power functions. */
-_Mdouble_BEGIN_NAMESPACE
/* Return X to the Y power. */
__MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
/* Return the square root of X. */
__MATHCALL (sqrt,, (_Mdouble_ __x));
-_Mdouble_END_NAMESPACE
#if defined __USE_XOPEN || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
/* Return `sqrt(X*X + Y*Y)'. */
__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
-__END_NAMESPACE_C99
#endif
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
/* Return the cube root of X. */
__MATHCALL (cbrt,, (_Mdouble_ __x));
-__END_NAMESPACE_C99
#endif
/* Nearest integer, absolute value, and remainder functions. */
-_Mdouble_BEGIN_NAMESPACE
/* Smallest integral value not less than X. */
__MATHCALLX (ceil,, (_Mdouble_ __x), (__const__));
@@ -186,24 +167,17 @@ __MATHCALLX (floor,, (_Mdouble_ __x), (__const__));
/* Floating-point modulo remainder of X/Y. */
__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
-
-/* Return 0 if VALUE is finite or NaN, +1 if it
- is +Infinity, -1 if it is -Infinity. */
-__MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
-
-/* Return nonzero if VALUE is finite and not NaN. */
-__MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
-_Mdouble_END_NAMESPACE
-
#ifdef __USE_MISC
-# if (!defined __cplusplus \
- || __cplusplus < 201103L /* isinf conflicts with C++11. */ \
- || __MATH_DECLARING_DOUBLE == 0) /* isinff or isinfl don't. */
+# if ((!defined __cplusplus \
+ || __cplusplus < 201103L /* isinf conflicts with C++11. */ \
+ || __MATH_DECLARING_DOUBLE == 0)) /* isinff or isinfl don't. */ \
+ && !__MATH_DECLARING_FLOATN
/* Return 0 if VALUE is finite or NaN, +1 if it
is +Infinity, -1 if it is -Infinity. */
__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
# endif
+# if !__MATH_DECLARING_FLOATN
/* Return nonzero if VALUE is finite and not NaN. */
__MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
@@ -213,30 +187,26 @@ __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
/* Return the fractional part of X after dividing out `ilogb (X)'. */
__MATHCALL (significand,, (_Mdouble_ __x));
+# endif
+
#endif /* Use misc. */
#ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
/* Return X with its signed changed to Y's. */
__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
-__END_NAMESPACE_C99
#endif
#ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
/* Return representation of qNaN for double type. */
-__MATHCALLX (nan,, (const char *__tagb), (__const__));
-__END_NAMESPACE_C99
+__MATHCALL (nan,, (const char *__tagb));
#endif
-/* Return nonzero if VALUE is not a number. */
-__MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
-
#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
-# if (!defined __cplusplus \
- || __cplusplus < 201103L /* isnan conflicts with C++11. */ \
- || __MATH_DECLARING_DOUBLE == 0) /* isnanf or isnanl don't. */
+# if ((!defined __cplusplus \
+ || __cplusplus < 201103L /* isnan conflicts with C++11. */ \
+ || __MATH_DECLARING_DOUBLE == 0)) /* isnanf or isnanl don't. */ \
+ && !__MATH_DECLARING_FLOATN
/* Return nonzero if VALUE is not a number. */
__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
# endif
@@ -254,24 +224,22 @@ __MATHCALL (yn,, (int, _Mdouble_));
#if defined __USE_XOPEN || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
/* Error and gamma functions. */
__MATHCALL (erf,, (_Mdouble_));
__MATHCALL (erfc,, (_Mdouble_));
__MATHCALL (lgamma,, (_Mdouble_));
-__END_NAMESPACE_C99
#endif
#ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
/* True gamma function. */
__MATHCALL (tgamma,, (_Mdouble_));
-__END_NAMESPACE_C99
#endif
#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
+# if !__MATH_DECLARING_FLOATN
/* Obsolete alias for `lgamma'. */
__MATHCALL (gamma,, (_Mdouble_));
+# endif
#endif
#ifdef __USE_MISC
@@ -283,15 +251,21 @@ __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
/* Return the integer nearest X in the direction of the
prevailing rounding mode. */
__MATHCALL (rint,, (_Mdouble_ __x));
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
-__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
-# if defined __USE_ISOC99 && !defined __LDBL_COMPAT
-__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
+__MATHCALL (nextafter,, (_Mdouble_ __x, _Mdouble_ __y));
+# if defined __USE_ISOC99 && !defined __LDBL_COMPAT && !__MATH_DECLARING_FLOATN
+__MATHCALL (nexttoward,, (_Mdouble_ __x, long double __y));
+# endif
+
+# if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN
+/* Return X - epsilon. */
+__MATHCALL (nextdown,, (_Mdouble_ __x));
+/* Return X + epsilon. */
+__MATHCALL (nextup,, (_Mdouble_ __x));
# endif
/* Return the remainder of integer divison X / Y with infinite precision. */
@@ -306,6 +280,11 @@ __MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
__MATHDECL (int,ilogb,, (_Mdouble_ __x));
#endif
+#if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN
+/* Like ilogb, but returning long int. */
+__MATHDECL (long int, llogb,, (_Mdouble_ __x));
+#endif
+
#ifdef __USE_ISOC99
/* Return X times (2 to the Nth power). */
__MATHCALL (scalbln,, (_Mdouble_ __x, long int __n));
@@ -352,33 +331,67 @@ __MATHCALLX (fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
/* Return minimum numeric value from X and Y. */
__MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
+/* Multiply-add function computed as a ternary operation. */
+__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
+#endif /* Use ISO C99. */
+
+#if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN
+/* Round X to nearest integer value, rounding halfway cases to even. */
+__MATHCALLX (roundeven,, (_Mdouble_ __x), (__const__));
+
+/* Round X to nearest signed integer value, not raising inexact, with
+ control of rounding direction and width of result. */
+__MATHDECL (__intmax_t, fromfp,, (_Mdouble_ __x, int __round,
+ unsigned int __width));
+
+/* Round X to nearest unsigned integer value, not raising inexact,
+ with control of rounding direction and width of result. */
+__MATHDECL (__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round,
+ unsigned int __width));
+
+/* Round X to nearest signed integer value, raising inexact for
+ non-integers, with control of rounding direction and width of
+ result. */
+__MATHDECL (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round,
+ unsigned int __width));
+
+/* Round X to nearest unsigned integer value, raising inexact for
+ non-integers, with control of rounding direction and width of
+ result. */
+__MATHDECL (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round,
+ unsigned int __width));
+
+/* Return value with maximum magnitude. */
+__MATHCALLX (fmaxmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
-/* Classify given number. */
-__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value))
+/* Return value with minimum magnitude. */
+__MATHCALLX (fminmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
+
+/* Total order operation. */
+__MATHDECL_1 (int, totalorder,, (_Mdouble_ __x, _Mdouble_ __y))
__attribute__ ((__const__));
-/* Test for negative number. */
-__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
+/* Total order operation on absolute values. */
+__MATHDECL_1 (int, totalordermag,, (_Mdouble_ __x, _Mdouble_ __y))
__attribute__ ((__const__));
+/* Canonicalize floating-point representation. */
+__MATHDECL_1 (int, canonicalize,, (_Mdouble_ *__cx, const _Mdouble_ *__x));
-/* Multiply-add function computed as a ternary operation. */
-__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
-#endif /* Use ISO C99. */
+/* Get NaN payload. */
+__MATHCALL (getpayload,, (const _Mdouble_ *__x));
-#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__END_NAMESPACE_C99
-#endif
+/* Set quiet NaN payload. */
+__MATHDECL_1 (int, setpayload,, (_Mdouble_ *__x, _Mdouble_ __payload));
-#ifdef __USE_GNU
-/* Test for signaling NaN. */
-__MATHDECL_1 (int, __issignaling,, (_Mdouble_ __value))
- __attribute__ ((__const__));
+/* Set signaling NaN payload. */
+__MATHDECL_1 (int, setpayloadsig,, (_Mdouble_ *__x, _Mdouble_ __payload));
#endif
-#if defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
- && __MATH_DECLARING_DOUBLE \
- && !defined __USE_XOPEN2K8)
+#if (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
+ && __MATH_DECLARING_DOUBLE \
+ && !defined __USE_XOPEN2K8)) \
+ && !__MATH_DECLARING_FLOATN
/* Return X times (2 to the Nth power). */
__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
#endif