summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
commit0ac5ae2335292908f39031b1ea9fe8edce433c0f (patch)
treef9d26c8abc0de39d18d4c13e70f6022cdc6b461f /math
parenta843a204a3e8a0dd53584dad3668771abaec84ac (diff)
Optimize libm
libm is now somewhat integrated with gcc's -ffinite-math-only option and lots of the wrapper functions have been optimized.
Diffstat (limited to 'math')
-rw-r--r--math/Makefile6
-rw-r--r--math/Versions29
-rw-r--r--math/bits/math-finite.h315
-rw-r--r--math/e_acoshl.c1
-rw-r--r--math/e_acosl.c1
-rw-r--r--math/e_asinl.c1
-rw-r--r--math/e_atan2l.c1
-rw-r--r--math/e_atanhl.c1
-rw-r--r--math/e_coshl.c1
-rw-r--r--math/e_exp10.c3
-rw-r--r--math/e_exp10f.c3
-rw-r--r--math/e_exp10l.c3
-rw-r--r--math/e_exp2l.c1
-rw-r--r--math/e_fmodl.c1
-rw-r--r--math/e_gammal_r.c1
-rw-r--r--math/e_hypotl.c1
-rw-r--r--math/e_j0l.c2
-rw-r--r--math/e_j1l.c2
-rw-r--r--math/e_jnl.c2
-rw-r--r--math/e_lgammal_r.c1
-rw-r--r--math/e_log10l.c1
-rw-r--r--math/e_log2l.c1
-rw-r--r--math/e_logl.c1
-rw-r--r--math/e_powl.c1
-rw-r--r--math/e_scalb.c112
-rw-r--r--math/e_scalbf.c109
-rw-r--r--math/e_scalbl.c114
-rw-r--r--math/e_sinhl.c1
-rw-r--r--math/e_sqrtl.c1
-rw-r--r--math/math.h23
-rw-r--r--math/math_private.h1
-rw-r--r--math/w_acos.c62
-rw-r--r--math/w_acosf.c64
-rw-r--r--math/w_acosh.c59
-rw-r--r--math/w_acoshf.c62
-rw-r--r--math/w_acoshl.c61
-rw-r--r--math/w_acosl.c64
-rw-r--r--math/w_asin.c61
-rw-r--r--math/w_asinf.c65
-rw-r--r--math/w_asinl.c65
-rw-r--r--math/w_atan2.c53
-rw-r--r--math/w_atan2f.c54
-rw-r--r--math/w_atan2l.c55
-rw-r--r--math/w_atanh.c64
-rw-r--r--math/w_atanhf.c67
-rw-r--r--math/w_atanhl.c66
-rw-r--r--math/w_cosh.c31
-rw-r--r--math/w_coshf.c35
-rw-r--r--math/w_coshl.c30
-rw-r--r--math/w_exp10.c58
-rw-r--r--math/w_exp10f.c61
-rw-r--r--math/w_exp10l.c59
-rw-r--r--math/w_exp2.c26
-rw-r--r--math/w_exp2f.c26
-rw-r--r--math/w_exp2l.c20
-rw-r--r--math/w_fmod.c61
-rw-r--r--math/w_fmodf.c62
-rw-r--r--math/w_fmodl.c63
-rw-r--r--math/w_hypot.c29
-rw-r--r--math/w_hypotf.c31
-rw-r--r--math/w_hypotl.c26
-rw-r--r--math/w_j0.c104
-rw-r--r--math/w_j0f.c110
-rw-r--r--math/w_j0l.c108
-rw-r--r--math/w_j1.c105
-rw-r--r--math/w_j1f.c110
-rw-r--r--math/w_j1l.c108
-rw-r--r--math/w_jn.c127
-rw-r--r--math/w_jnf.c109
-rw-r--r--math/w_lgamma.c43
-rw-r--r--math/w_lgamma_r.c35
-rw-r--r--math/w_lgammaf.c45
-rw-r--r--math/w_lgammaf_r.c43
-rw-r--r--math/w_lgammal.c43
-rw-r--r--math/w_lgammal_r.c36
-rw-r--r--math/w_log.c69
-rw-r--r--math/w_log10.c72
-rw-r--r--math/w_log10f.c75
-rw-r--r--math/w_log10l.c74
-rw-r--r--math/w_log2.c49
-rw-r--r--math/w_log2f.c53
-rw-r--r--math/w_log2l.c51
-rw-r--r--math/w_logf.c72
-rw-r--r--math/w_logl.c71
-rw-r--r--math/w_pow.c111
-rw-r--r--math/w_powf.c122
-rw-r--r--math/w_powl.c115
-rw-r--r--math/w_remainder.c60
-rw-r--r--math/w_remainderf.c62
-rw-r--r--math/w_remainderl.c63
-rw-r--r--math/w_scalb.c94
-rw-r--r--math/w_scalbf.c97
-rw-r--r--math/w_scalbl.c96
-rw-r--r--math/w_sinh.c29
-rw-r--r--math/w_sinhf.c34
-rw-r--r--math/w_sinhl.c29
-rw-r--r--math/w_sqrt.c58
-rw-r--r--math/w_sqrtf.c60
-rw-r--r--math/w_sqrtl.c60
-rw-r--r--math/w_tgamma.c26
-rw-r--r--math/w_tgammaf.c34
-rw-r--r--math/w_tgammal.c28
102 files changed, 2418 insertions, 2753 deletions
diff --git a/math/Makefile b/math/Makefile
index 25cb5f6038..431eb5aa4b 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1996-2001,2002,2003,2004,2005,2006,2011
-# Free Software Foundation, Inc.
+# Copyright (C) 1996-2006,2011 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
@@ -25,7 +24,8 @@ subdir := math
headers := math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
bits/huge_valf.h bits/huge_vall.h bits/inf.h bits/nan.h \
fpu_control.h complex.h bits/cmathcalls.h fenv.h \
- bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h
+ bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
+ bits/math-finite.h
# Internal header files.
distribute := math_ldbl.h math_private.h machine/asm.h
diff --git a/math/Versions b/math/Versions
index 39c47626f6..66bf460261 100644
--- a/math/Versions
+++ b/math/Versions
@@ -168,4 +168,33 @@ libm {
# puts exp2l in GLIBC_2.1, which will override this entry.
exp2l;
}
+ GLIBC_2.15 {
+ # Optimized -ffinite-math-only entry points
+ __acos_finite; __acosf_finite; __acosl_finite;
+ __acosh_finite; __acoshf_finite; __acoshl_finite;
+ __asin_finite; __asinf_finite; __asinl_finite;
+ __atan2_finite; __atan2f_finite; __atan2l_finite;
+ __atanh_finite; __atanhf_finite; __atanhl_finite;
+ __cosh_finite; __coshf_finite; __coshl_finite;
+ __exp10_finite; __exp10f_finite; __exp10l_finite;
+ __exp2_finite; __exp2f_finite; __exp2l_finite;
+ __fmod_finite; __fmodf_finite; __fmodl_finite;
+ __hypot_finite; __hypotf_finite; __hypotl_finite;
+ __j0_finite; __j0f_finite; __j0l_finite;
+ __y0_finite; __y0f_finite; __y0l_finite;
+ __j1_finite; __j1f_finite; __j1l_finite;
+ __y1_finite; __y1f_finite; __y1l_finite;
+ __jn_finite; __jnf_finite; __jnl_finite;
+ __yn_finite; __ynf_finite; __ynl_finite;
+ __lgamma_r_finite; __lgammaf_r_finite; __lgammal_r_finite;
+ __log_finite; __logf_finite; __logl_finite;
+ __log10_finite; __log10f_finite; __log10l_finite;
+ __log2_finite; __log2f_finite; __log2l_finite;
+ __pow_finite; __powf_finite; __powl_finite;
+ __remainder_finite; __remainderf_finite; __remainderl_finite;
+ __scalb_finite; __scalbf_finite; __scalbl_finite;
+ __sinh_finite; __sinhf_finite; __sinhl_finite;
+ __sqrt_finite; __sqrtf_finite; __sqrtl_finite;
+ __gamma_r_finite; __gammaf_r_finite; __gammal_r_finite;
+ }
}
diff --git a/math/bits/math-finite.h b/math/bits/math-finite.h
new file mode 100644
index 0000000000..c6b952736d
--- /dev/null
+++ b/math/bits/math-finite.h
@@ -0,0 +1,315 @@
+/* Entry points to finite-math-only compiler runs.
+ Copyright (C) 2011 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MATH_H
+# error "Never use <bits/math-finite.h> directly; include <math.h> instead."
+#endif
+
+/* acos. */
+extern double acos (double) __asm__ ("__acos_finite");
+extern float acosf (float) __asm__ ("__acosf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double acosl (long double) __asm__ ("__acosl_finite");
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+/* acosh. */
+extern double acosh (double) __asm__ ("__acosh_finite");
+extern float acoshf (float) __asm__ ("__acoshf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double acoshl (long double) __asm__ ("__acoshl_finite");
+# endif
+#endif
+
+/* asin. */
+extern double asin (double) __asm__ ("__asin_finite");
+extern float asinf (float) __asm__ ("__asinf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double asinl (long double) __asm__ ("__asinl_finite");
+#endif
+
+/* atan2. */
+extern double atan2 (double, double) __asm__ ("__atan2_finite");
+extern float atan2f (float, float) __asm__ ("__atan2f_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double atan2l (long double, long double) __asm__ ("__atan2l_finite");
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+/* atanh. */
+extern double atanh (double) __asm__ ("__atanh_finite");
+extern float atanhf (float) __asm__ ("__atanhf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double atanhl (long double) __asm__ ("__atanhl_finite");
+# endif
+#endif
+
+/* cosh. */
+extern double cosh (double) __asm__ ("__cosh_finite");
+extern float coshf (float) __asm__ ("__coshf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double coshl (long double) __asm__ ("__coshl_finite");
+#endif
+
+#ifdef __USE_GNU
+/* exp10. */
+extern double exp10 (double) __asm__ ("__exp10_finite");
+extern float exp10f (float) __asm__ ("__exp10f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double exp10l (long double) __asm__ ("__exp10l_finite");
+# endif
+
+/* pow10. */
+extern double pow10 (double) __asm__ ("__exp10_finite");
+extern float pow10f (float) __asm__ ("__exp10f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double pow10l (long double) __asm__ ("__exp10l_finite");
+# endif
+#endif
+
+#ifdef __USE_ISOC99
+/* exp2. */
+extern double exp2 (double) __asm__ ("__exp2_finite");
+extern float exp2f (float) __asm__ ("__exp2f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double exp2l (long double) __asm__ ("__exp2l_finite");
+# endif
+#endif
+
+/* fmod. */
+extern double fmod (double, double) __asm__ ("__fmod_finite");
+extern float fmodf (float, float) __asm__ ("__fmodf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double fmodl (long double, long double) __asm__ ("__fmodl_finite");
+#endif
+
+#ifdef __USE_ISOC99
+/* hypot. */
+extern double hypot (double, double) __asm__ ("__hypot_finite");
+extern float hypotf (float, float) __asm__ ("__hypotf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double hypotl (long double, long double) __asm__ ("__hypotl_finite");
+# endif
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN
+/* j0. */
+extern double j0 (double) __asm__ ("__j0_finite");
+extern float j0f (float) __asm__ ("__j0f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double j0l (long double) __asm__ ("__j0l_finite");
+# endif
+
+/* y0. */
+extern double y0 (double) __asm__ ("__y0_finite");
+extern float y0f (float) __asm__ ("__y0f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double y0l (long double) __asm__ ("__y0l_finite");
+# endif
+
+/* j1. */
+extern double j1 (double) __asm__ ("__j1_finite");
+extern float j1f (float) __asm__ ("__j1f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double j1l (long double) __asm__ ("__j1l_finite");
+# endif
+
+/* y1. */
+extern double y1 (double) __asm__ ("__y1_finite");
+extern float y1f (float) __asm__ ("__y1f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double y1l (long double) __asm__ ("__y1l_finite");
+# endif
+
+/* jn. */
+extern double jn (int, double) __asm__ ("__jn_finite");
+extern float jnf (int, float) __asm__ ("__jnf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double jnl (int, long double) __asm__ ("__jnl_finite");
+# endif
+
+/* yn. */
+extern double yn (int, double) __asm__ ("__yn_finite");
+extern float ynf (int, float) __asm__ ("__ynf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double ynl (int, long double) __asm__ ("__ynl_finite");
+# endif
+#endif
+
+#ifdef __USE_MISC
+/* lgamma_r. */
+extern double lgamma_r (double, int *) __asm__ ("__lgamma_r_finite");
+extern float lgammaf_r (float, int *) __asm__ ("__lgammaf_r_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double lgammal_r (long double, int *) __asm__ ("__lgammal_r_finite");
+# endif
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
+/* lgamma. */
+__extern_always_inline double lgamma (double __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgamma_r (__d, &__local_signgam);
+# else
+ return lgamma_r (__d, &signgam);
+# endif
+}
+__extern_always_inline float lgammaf (float __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgammaf_r (__d, &__local_signgam);
+# else
+ return lgammaf_r (__d, &signgam);
+# endif
+}
+# ifdef __MATH_DECLARE_LDOUBLE
+__extern_always_inline long double lgammal (long double __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgammal_r (__d, &__local_signgam);
+# else
+ return lgammal_r (__d, &signgam);
+# endif
+}
+# endif
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN
+/* gamma. */
+__extern_always_inline double gamma (double __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgamma_r (__d, &__local_signgam);
+# else
+ return lgamma_r (__d, &signgam);
+# endif
+}
+__extern_always_inline float gammaf (float __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgammaf_r (__d, &__local_signgam);
+# else
+ return lgammaf_r (__d, &signgam);
+# endif
+}
+# ifdef __MATH_DECLARE_LDOUBLE
+__extern_always_inline long double gammal (long double __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgammal_r (__d, &__local_signgam);
+# else
+ return lgammal_r (__d, &signgam);
+# endif
+}
+# endif
+#endif
+
+/* log. */
+extern double log (double) __asm__ ("__log_finite");
+extern float logf (float) __asm__ ("__logf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double logl (long double) __asm__ ("__logl_finite");
+#endif
+
+/* log10. */
+extern double log10 (double) __asm__ ("__log10_finite");
+extern float log10f (float) __asm__ ("__log10f_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double log10l (long double) __asm__ ("__log10l_finite");
+#endif
+
+#ifdef __USE_ISOC99
+/* log2. */
+extern double log2 (double) __asm__ ("__log2_finite");
+extern float log2f (float) __asm__ ("__log2f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double log2l (long double) __asm__ ("__log2l_finite");
+# endif
+#endif
+
+/* pow. */
+extern double pow (double, double) __asm__ ("__pow_finite");
+extern float powf (float, float) __asm__ ("__powf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double powl (long double, long double) __asm__ ("__powl_finite");
+#endif
+
+/* remainder. */
+extern double remainder (double, double) __asm__ ("__remainder_finite");
+extern float remainderf (float, float) __asm__ ("__remainderf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double remainderl (long double, long double) __asm__ ("__remainderl_finite");
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+/* scalb. */
+extern double scalb (double, double) __asm__ ("__scalb_finite");
+extern float scalbf (float, float) __asm__ ("__scalbf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double scalbl (long double, long double) __asm__ ("__scalbl_finite");
+# endif
+#endif
+
+/* sinh. */
+extern double sinh (double) __asm__ ("__sinh_finite");
+extern float sinhf (float) __asm__ ("__sinhf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double sinhl (long double) __asm__ ("__sinhl_finite");
+#endif
+
+/* sqrt. */
+extern double sqrt (double) __asm__ ("__sqrt_finite");
+extern float sqrtf (float) __asm__ ("__sqrtf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double sqrtl (long double) __asm__ ("__sqrtl_finite");
+#endif
+
+#ifdef __USE_ISOC99
+/* tgamma. */
+extern double __gamma_r_finite (double, int *);
+__extern_always_inline double 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 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 tgammal (long double __d)
+{
+ int __local_signgam = 0;
+ long double __res = __gammal_r_finite (__d, &__local_signgam);
+ return __local_signgam < 0 ? -__res : __res;
+}
+# endif
+#endif
diff --git a/math/e_acoshl.c b/math/e_acoshl.c
index 2c2fbe8eb4..490fd10fd7 100644
--- a/math/e_acoshl.c
+++ b/math/e_acoshl.c
@@ -9,6 +9,7 @@ __ieee754_acoshl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_acoshl, __acoshl_finite)
stub_warning (acoshl)
#include <stub-tag.h>
diff --git a/math/e_acosl.c b/math/e_acosl.c
index d844d885b8..55d9ab0f68 100644
--- a/math/e_acosl.c
+++ b/math/e_acosl.c
@@ -9,6 +9,7 @@ __ieee754_acosl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_acosl, __acosl_finite)
stub_warning (acosl)
#include <stub-tag.h>
diff --git a/math/e_asinl.c b/math/e_asinl.c
index 3b26f030ef..8e6c47e702 100644
--- a/math/e_asinl.c
+++ b/math/e_asinl.c
@@ -9,6 +9,7 @@ __ieee754_asinl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_asinl, __asinl_finite)
stub_warning (asinl)
#include <stub-tag.h>
diff --git a/math/e_atan2l.c b/math/e_atan2l.c
index 0caed8a32f..8ca37622fc 100644
--- a/math/e_atan2l.c
+++ b/math/e_atan2l.c
@@ -9,6 +9,7 @@ __ieee754_atan2l (long double x, long double y)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_atan2l, __atan2l_finite)
stub_warning (atan2l)
#include <stub-tag.h>
diff --git a/math/e_atanhl.c b/math/e_atanhl.c
index 625d42db31..26c52e7936 100644
--- a/math/e_atanhl.c
+++ b/math/e_atanhl.c
@@ -9,6 +9,7 @@ __ieee754_atanhl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_atanhl, __atanhl_finite)
stub_warning (__ieee754_atanhl)
#include <stub-tag.h>
diff --git a/math/e_coshl.c b/math/e_coshl.c
index 0da319b785..92bfd7a188 100644
--- a/math/e_coshl.c
+++ b/math/e_coshl.c
@@ -9,6 +9,7 @@ __ieee754_coshl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_coshl, __coshl_finite)
stub_warning (__ieee754_coshl)
#include <stub-tag.h>
diff --git a/math/e_exp10.c b/math/e_exp10.c
index 231ceb2c24..ce14ea5f1b 100644
--- a/math/e_exp10.c
+++ b/math/e_exp10.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -28,3 +28,4 @@ __ieee754_exp10 (double arg)
replaced sometime (soon?). */
return __ieee754_exp (M_LN10 * arg);
}
+strong_alias (__ieee754_exp10, __exp10_finite)
diff --git a/math/e_exp10f.c b/math/e_exp10f.c
index 642ed838bd..68e9723b88 100644
--- a/math/e_exp10f.c
+++ b/math/e_exp10f.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -28,3 +28,4 @@ __ieee754_exp10f (float arg)
replaced sometime (soon?). */
return __ieee754_expf (M_LN10 * arg);
}
+strong_alias (__ieee754_exp10f, __exp10f_finite)
diff --git a/math/e_exp10l.c b/math/e_exp10l.c
index cbc1897e4c..6bd859fde5 100644
--- a/math/e_exp10l.c
+++ b/math/e_exp10l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -28,3 +28,4 @@ __ieee754_exp10l (long double arg)
replaced sometime (soon?). */
return __ieee754_expl (M_LN10l * arg);
}
+strong_alias (__ieee754_exp10l, __exp10l_finite)
diff --git a/math/e_exp2l.c b/math/e_exp2l.c
index d6d01550e2..e7e493933a 100644
--- a/math/e_exp2l.c
+++ b/math/e_exp2l.c
@@ -8,3 +8,4 @@ __ieee754_exp2l (long double x)
replaced sometime (soon?). */
return __ieee754_expl (M_LN2l * x);
}
+strong_alias (__ieee754_exp2l, __exp2l_finite)
diff --git a/math/e_fmodl.c b/math/e_fmodl.c
index 380da24e41..dbd361ebc9 100644
--- a/math/e_fmodl.c
+++ b/math/e_fmodl.c
@@ -9,6 +9,7 @@ __ieee754_fmodl (long double x, long double y)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_fmodl, __fmodl_finite)
stub_warning (fmodl)
#include <stub-tag.h>
diff --git a/math/e_gammal_r.c b/math/e_gammal_r.c
index 1c45c8421b..c0ae70426a 100644
--- a/math/e_gammal_r.c
+++ b/math/e_gammal_r.c
@@ -10,6 +10,7 @@ __ieee754_gammal_r (long double x, int *signgamp)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_gammal_r, __gammal_r_finite)
stub_warning (__ieee754_gammal_r)
#include <stub-tag.h>
diff --git a/math/e_hypotl.c b/math/e_hypotl.c
index 07df22eb36..73bad62775 100644
--- a/math/e_hypotl.c
+++ b/math/e_hypotl.c
@@ -9,6 +9,7 @@ __ieee754_hypotl (long double x, long double y)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_hypotl, __hypotl_finite)
stub_warning (__ieee754_hypotl)
#include <stub-tag.h>
diff --git a/math/e_j0l.c b/math/e_j0l.c
index 7a167c277c..eb01ba67c7 100644
--- a/math/e_j0l.c
+++ b/math/e_j0l.c
@@ -10,6 +10,7 @@ __ieee754_j0l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_j0l, __j0l_finite)
stub_warning (j0l)
@@ -20,6 +21,7 @@ __ieee754_y0l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_y0l, __y0l_finite)
stub_warning (y0l)
#include <stub-tag.h>
diff --git a/math/e_j1l.c b/math/e_j1l.c
index 625e886851..7701f49ff9 100644
--- a/math/e_j1l.c
+++ b/math/e_j1l.c
@@ -10,6 +10,7 @@ __ieee754_j1l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_j1l, __j1l_finite)
stub_warning (j1l)
@@ -20,6 +21,7 @@ __ieee754_y1l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_y1l, __y1l_finite)
stub_warning (y1l)
#include <stub-tag.h>
diff --git a/math/e_jnl.c b/math/e_jnl.c
index a04c9fe51e..059b1db6bc 100644
--- a/math/e_jnl.c
+++ b/math/e_jnl.c
@@ -10,6 +10,7 @@ __ieee754_jnl (int n, long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_jnl, __jnl_finite)
stub_warning (jnl)
@@ -20,6 +21,7 @@ __ieee754_ynl (int n, long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_ynl, __ynl_finite)
stub_warning (ynl)
#include <stub-tag.h>
diff --git a/math/e_lgammal_r.c b/math/e_lgammal_r.c
index f46f7073a5..92e7700e2e 100644
--- a/math/e_lgammal_r.c
+++ b/math/e_lgammal_r.c
@@ -11,6 +11,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_lgammal_r, __lgammal_r_finite)
stub_warning (lgammal)
stub_warning (lgammal_r)
diff --git a/math/e_log10l.c b/math/e_log10l.c
index 5bc264b32c..2c7ff72c2c 100644
--- a/math/e_log10l.c
+++ b/math/e_log10l.c
@@ -9,6 +9,7 @@ __ieee754_log10l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_log10l, __log10l_finite)
stub_warning (log10l)
#include <stub-tag.h>
diff --git a/math/e_log2l.c b/math/e_log2l.c
index 681904bfbb..95929c3606 100644
--- a/math/e_log2l.c
+++ b/math/e_log2l.c
@@ -9,6 +9,7 @@ __ieee754_log2l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_log2l, __log2l_finite)
stub_warning (log2l)
#include <stub-tag.h>
diff --git a/math/e_logl.c b/math/e_logl.c
index 9ba9cfc799..95608ab553 100644
--- a/math/e_logl.c
+++ b/math/e_logl.c
@@ -9,6 +9,7 @@ __ieee754_logl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_logl, __logl_finite)
stub_warning (logl)
#include <stub-tag.h>
diff --git a/math/e_powl.c b/math/e_powl.c
index afc2248b6b..ab79b1a4b7 100644
--- a/math/e_powl.c
+++ b/math/e_powl.c
@@ -9,6 +9,7 @@ __ieee754_powl (long double x, long double y)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_powl, __powl_finite)
stub_warning (powl)
#include <stub-tag.h>
diff --git a/math/e_scalb.c b/math/e_scalb.c
index f2c207ac8b..3b81dd5653 100644
--- a/math/e_scalb.c
+++ b/math/e_scalb.c
@@ -1,71 +1,59 @@
-/* @(#)e_scalb.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_scalb.c,v 1.6 1995/05/10 20:46:09 jtc Exp $";
-#endif
+ 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.
-/*
- * __ieee754_scalb(x, fn) is provide for
- * passing various standard test suite. One
- * should use scalbn() instead.
- */
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef _SCALB_INT
-#ifdef __STDC__
- double __ieee754_scalb(double x, int fn)
-#else
- double __ieee754_scalb(x,fn)
- double x; int fn;
-#endif
-#else
-#ifdef __STDC__
- double __ieee754_scalb(double x, double fn)
-#else
- double __ieee754_scalb(x,fn)
- double x, fn;
-#endif
-#endif
+
+static double
+__attribute__ ((noinline))
+invalid_fn (double x, double fn)
{
-#ifdef _SCALB_INT
- return __scalbn(x,fn);
-#else
- if (__isnan(x)||__isnan(fn)) return x*fn;
- if (!__finite(fn)) {
- if(fn>0.0) return x*fn;
- else if (x == 0)
- return x;
- else if (!__finite (x))
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nan ("");
- }
- else return x/(-fn);
- }
- if (__rint(fn)!=fn)
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nan ("");
- }
- if ( fn > 65000.0) return __scalbn(x, 65000);
- if (-fn > 65000.0) return __scalbn(x,-65000);
- return __scalbn(x,(int)fn);
-#endif
+ if (__rint (fn) != fn)
+ {
+ feraiseexcept (FE_INVALID);
+ return __nan ("");
+ }
+ else if (fn > 65000.0)
+ return __scalbn (x, 65000);
+ else
+ return __scalbn (x,-65000);
+}
+
+
+double
+__ieee754_scalb (double x, double fn)
+{
+ if (__builtin_expect (__isnan (x), 0))
+ return x * fn;
+ if (__builtin_expect (!__finite (fn), 0))
+ {
+ if (__isnan (fn) || fn > 0.0)
+ return x * fn;
+ if (x == 0.0)
+ return x;
+ return x / -fn;
+ }
+ if (__builtin_expect ((double) (int) fn != fn, 0))
+ return invalid_fn (x, fn);
+
+ return __scalbn (x, (int) fn);
}
+strong_alias (__ieee754_scalb, __scalb_finite)
diff --git a/math/e_scalbf.c b/math/e_scalbf.c
index 3caa535b12..61847d9a56 100644
--- a/math/e_scalbf.c
+++ b/math/e_scalbf.c
@@ -1,68 +1,59 @@
-/* e_scalbf.c -- float version of e_scalb.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_scalbf.c,v 1.3 1995/05/10 20:46:12 jtc Exp $";
-#endif
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef _SCALB_INT
-#ifdef __STDC__
- float __ieee754_scalbf(float x, int fn)
-#else
- float __ieee754_scalbf(x,fn)
- float x; int fn;
-#endif
-#else
-#ifdef __STDC__
- float __ieee754_scalbf(float x, float fn)
-#else
- float __ieee754_scalbf(x,fn)
- float x, fn;
-#endif
-#endif
+
+static float
+__attribute__ ((noinline))
+invalid_fn (float x, float fn)
{
-#ifdef _SCALB_INT
- return __scalbnf(x,fn);
-#else
- if (__isnanf(x)||__isnanf(fn)) return x*fn;
- if (!__finitef(fn)) {
- if(fn>(float)0.0) return x*fn;
- else if (x == 0)
- return x;
- else if (!__finitef (x))
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nanf ("");
- }
- else return x/(-fn);
- }
- if (__rintf(fn)!=fn)
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nanf ("");
- }
- if ( fn > (float)65000.0) return __scalbnf(x, 65000);
- if (-fn > (float)65000.0) return __scalbnf(x,-65000);
- return __scalbnf(x,(int)fn);
-#endif
+ if (__rintf (fn) != fn)
+ {
+ feraiseexcept (FE_INVALID);
+ return __nan ("");
+ }
+ else if (fn > 65000.0f)
+ return __scalbnf (x, 65000);
+ else
+ return __scalbnf (x,-65000);
+}
+
+
+float
+__ieee754_scalbf (float x, float fn)
+{
+ if (__builtin_expect (__isnanf (x), 0))
+ return x * fn;
+ if (__builtin_expect (!__finitef (fn), 0))
+ {
+ if (__isnanf (fn) || fn > 0.0f)
+ return x * fn;
+ if (x == 0.0f)
+ return x;
+ return x / -fn;
+ }
+ if (__builtin_expect ((float) (int) fn != fn, 0))
+ return invalid_fn (x, fn);
+
+ return __scalbnf (x, (int) fn);
}
+strong_alias (__ieee754_scalbf, __scalbf_finite)
diff --git a/math/e_scalbl.c b/math/e_scalbl.c
index ad3595c0c5..6b36b71229 100644
--- a/math/e_scalbl.c
+++ b/math/e_scalbl.c
@@ -1,75 +1,59 @@
-/* e_scalbl.c -- long double version of s_scalb.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * __ieee754_scalbl(x, fn) is provide for
- * passing various standard test suite. One
- * should use scalbnl() instead.
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef _SCALB_INT
-#ifdef __STDC__
- long double __ieee754_scalbl(long double x, int fn)
-#else
- long double __ieee754_scalbl(x,fn)
- long double x; int fn;
-#endif
-#else
-#ifdef __STDC__
- long double __ieee754_scalbl(long double x, long double fn)
-#else
- long double __ieee754_scalbl(x,fn)
- long double x, fn;
-#endif
-#endif
+
+static long double
+__attribute__ ((noinline))
+invalid_fn (long double x, long double fn)
+{
+ if (__rintl (fn) != fn)
+ {
+ feraiseexcept (FE_INVALID);
+ return __nan ("");
+ }
+ else if (fn > 65000.0L)
+ return __scalbnl (x, 65000);
+ else
+ return __scalbnl (x,-65000);
+}
+
+
+long double
+__ieee754_scalbl (long double x, long double fn)
{
-#ifdef _SCALB_INT
- return __scalbnl(x,fn);
-#else
- if (__isnanl(x)||__isnanl(fn)) return x*fn;
- if (!__finitel(fn)) {
- if(fn>0.0) return x*fn;
- else if (x == 0)
- return x;
- else if (!__finitel (x))
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nanl ("");
- }
- else return x/(-fn);
- }
- if (__rintl(fn)!=fn)
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nanl ("");
- }
- if ( fn > 65000.0) return __scalbnl(x, 65000);
- if (-fn > 65000.0) return __scalbnl(x,-65000);
- return __scalbnl(x,(int)fn);
-#endif
+ if (__builtin_expect (__isnanl (x), 0))
+ return x * fn;
+ if (__builtin_expect (!__finitel (fn), 0))
+ {
+ if (__isnanl (fn) || fn > 0.0L)
+ return x * fn;
+ if (x == 0.0L)
+ return x;
+ return x / -fn;
+ }
+ if (__builtin_expect ((long double) (int) fn != fn, 0))
+ return invalid_fn (x, fn);
+
+ return __scalbnl (x, (int) fn);
}
+strong_alias (__ieee754_scalbl, __scalbl_finite)
diff --git a/math/e_sinhl.c b/math/e_sinhl.c
index 4cec79cb2d..fc756c9eba 100644
--- a/math/e_sinhl.c
+++ b/math/e_sinhl.c
@@ -9,6 +9,7 @@ __ieee754_sinhl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_sinhl, __sinhl_finite)
stub_warning (__ieee754_sinhl)
#include <stub-tag.h>
diff --git a/math/e_sqrtl.c b/math/e_sqrtl.c
index 7680bdb145..af9c2b51bf 100644
--- a/math/e_sqrtl.c
+++ b/math/e_sqrtl.c
@@ -9,6 +9,7 @@ __ieee754_sqrtl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_sqrtl, __sqrtl_finite)
stub_warning (sqrtl)
#include <stub-tag.h>
diff --git a/math/math.h b/math/math.h
index aeb54d9ed8..8b98ff331e 100644
--- a/math/math.h
+++ b/math/math.h
@@ -1,5 +1,5 @@
/* Declarations for math functions.
- Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006, 2009
+ Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006, 2009, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -64,10 +64,10 @@ __BEGIN_DECLS
#define __MATHDECL_1(type, function,suffix, args) \
extern type __MATH_PRECNAME(function,suffix) args __THROW
-#define _Mdouble_ double
+#define _Mdouble_ double
#define __MATH_PRECNAME(name,r) __CONCAT(name,r)
-# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
-# define _Mdouble_END_NAMESPACE __END_NAMESPACE_STD
+#define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
+#define _Mdouble_END_NAMESPACE __END_NAMESPACE_STD
#include <bits/mathcalls.h>
#undef _Mdouble_
#undef _Mdouble_BEGIN_NAMESPACE
@@ -83,7 +83,7 @@ __BEGIN_DECLS
# ifndef _Mfloat_
# define _Mfloat_ float
# endif
-# define _Mdouble_ _Mfloat_
+# define _Mdouble_ _Mfloat_
# ifdef __STDC__
# define __MATH_PRECNAME(name,r) name##f##r
# else
@@ -130,7 +130,7 @@ extern long double __REDIRECT_NTH (nexttowardl,
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
-# define _Mdouble_ _Mlong_double_
+# define _Mdouble_ _Mlong_double_
# ifdef __STDC__
# define __MATH_PRECNAME(name,r) name##l##r
# else
@@ -138,10 +138,11 @@ extern long double __REDIRECT_NTH (nexttowardl,
# endif
# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
# define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99
+# define __MATH_DECLARE_LDOUBLE 1
# include <bits/mathcalls.h>
# undef _Mdouble_
-# undef _Mdouble_BEGIN_NAMESPACE
-# undef _Mdouble_END_NAMESPACE
+# undef _Mdouble_BEGIN_NAMESPACE
+# undef _Mdouble_END_NAMESPACE
# undef __MATH_PRECNAME
# endif /* __STDC__ || __GNUC__ */
@@ -416,6 +417,12 @@ extern int matherr (struct exception *__exc);
# include <bits/mathinline.h>
#endif
+/* Define special entry points to use when the compiler got told to
+ only expect finite results. */
+#if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0
+# include <bits/math-finite.h>
+#endif
+
#ifdef __USE_ISOC99
/* If we've still got undefined comparison macros, provide defaults. */
diff --git a/math/math_private.h b/math/math_private.h
index e5ca61f0b8..c5fbf15f65 100644
--- a/math/math_private.h
+++ b/math/math_private.h
@@ -202,6 +202,7 @@ extern double __ieee754_scalb (double,double);
/* fdlibm kernel function */
extern double __kernel_standard (double,double,int);
+extern float __kernel_standard_f (float,float,int);
extern double __kernel_sin (double,double,int);
extern double __kernel_cos (double,double);
extern double __kernel_tan (double,double,int);
diff --git a/math/w_acos.c b/math/w_acos.c
index 0bf5a80942..617cfdae49 100644
--- a/math/w_acos.c
+++ b/math/w_acos.c
@@ -1,45 +1,39 @@
-/* @(#)w_acos.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acos.c,v 1.6 1995/05/10 20:48:26 jtc Exp $";
-#endif
+ 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.
-/*
- * wrap_acos(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __acos(double x) /* wrapper acos */
-#else
- double __acos(x) /* wrapper acos */
- double x;
-#endif
+/* wrapper acos */
+double
+__acos (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_acos(x);
-#else
- double z;
- z = __ieee754_acos(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
- if(fabs(x)>1.0) {
- return __kernel_standard(x,x,1); /* acos(|x|>1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabs (x) > 1.0, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* acos(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 1);
+ }
+
+ return __ieee754_acos (x);
}
weak_alias (__acos, acos)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_acosf.c b/math/w_acosf.c
index 37d22afea8..bb3aae0010 100644
--- a/math/w_acosf.c
+++ b/math/w_acosf.c
@@ -1,48 +1,38 @@
-/* w_acosf.c -- float version of w_acos.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acosf.c,v 1.3 1995/05/10 20:48:29 jtc Exp $";
-#endif
+ 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.
-/*
- * wrap_acosf(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __acosf(float x) /* wrapper acosf */
-#else
- float __acosf(x) /* wrapper acosf */
- float x;
-#endif
+/* wrapper acosf */
+float
+__acosf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_acosf(x);
-#else
- float z;
- z = __ieee754_acosf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(fabsf(x)>(float)1.0) {
- /* acosf(|x|>1) */
- return (float)__kernel_standard((double)x,(double)x,101);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) > 1.0f, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* acos(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 101);
+ }
+
+ return __ieee754_acosf (x);
}
weak_alias (__acosf, acosf)
diff --git a/math/w_acosh.c b/math/w_acosh.c
index 18ea8cc1b7..50201b4d22 100644
--- a/math/w_acosh.c
+++ b/math/w_acosh.c
@@ -1,44 +1,35 @@
-/* @(#)w_acosh.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acosh.c,v 1.6 1995/05/10 20:48:31 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper acosh(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __acosh(double x) /* wrapper acosh */
-#else
- double __acosh(x) /* wrapper acosh */
- double x;
-#endif
+
+/* wrapper acosh */
+double
+__acosh (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_acosh(x);
-#else
- double z;
- z = __ieee754_acosh(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
- if(x<1.0) {
- return __kernel_standard(x,x,29); /* acosh(x<1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x < 1.0, 0) && _LIB_VERSION != _IEEE_)
+ /* acosh(x<1) */
+ return __kernel_standard (x, x, 29);
+
+ return __ieee754_acosh (x);
}
weak_alias (__acosh, acosh)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_acoshf.c b/math/w_acoshf.c
index d7d6d4eb41..2b07824a0e 100644
--- a/math/w_acoshf.c
+++ b/math/w_acoshf.c
@@ -1,48 +1,34 @@
-/* w_acoshf.c -- float version of w_acosh.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- *
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acoshf.c,v 1.3 1995/05/10 20:48:33 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper acoshf(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __acoshf(float x) /* wrapper acoshf */
-#else
- float __acoshf(x) /* wrapper acoshf */
- float x;
-#endif
+
+/* wrapper acoshf */
+float
+__acoshf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_acoshf(x);
-#else
- float z;
- z = __ieee754_acoshf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(x<(float)1.0) {
- /* acosh(x<1) */
- return (float)__kernel_standard((double)x,(double)x,129);
- } else
- return z;
-#endif
+ if (__builtin_expect (x < 1.0f, 0) && _LIB_VERSION != _IEEE_)
+ /* acosh(x<1) */
+ return __kernel_standard_f (x, x, 129);
+
+ return __ieee754_acoshf (x);
}
weak_alias (__acoshf, acoshf)
diff --git a/math/w_acoshl.c b/math/w_acoshl.c
index 3c77321dc2..0f7068a96e 100644
--- a/math/w_acoshl.c
+++ b/math/w_acoshl.c
@@ -1,47 +1,34 @@
-/* w_acoshl.c -- long double version of w_acosh.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrapper acoshl(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __acoshl(long double x) /* wrapper acosh */
-#else
- long double __acoshl(x) /* wrapper acosh */
- long double x;
-#endif
+
+/* wrapper acosl */
+long double
+__acoshl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_acoshl(x);
-#else
- long double z;
- z = __ieee754_acoshl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(x<1.0) {
- return __kernel_standard(x,x,229); /* acoshl(x<1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x < 1.0L, 0) && _LIB_VERSION != _IEEE_)
+ /* acosh(x<1) */
+ return __kernel_standard (x, x, 229);
+
+ return __ieee754_acoshl (x);
}
weak_alias (__acoshl, acoshl)
diff --git a/math/w_acosl.c b/math/w_acosl.c
index a16c55b97a..dd1039ec85 100644
--- a/math/w_acosl.c
+++ b/math/w_acosl.c
@@ -1,48 +1,38 @@
-/* w_acosl.c -- long double version of w_acos.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrap_acosl(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __acosl(long double x) /* wrapper acos */
-#else
- long double __acosl(x) /* wrapper acos */
- long double x;
-#endif
+/* wrapper acosl */
+long double
+__acosl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_acosl(x);
-#else
- long double z;
- z = __ieee754_acosl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(fabsl(x)>1.0) {
- return __kernel_standard(x,x,201); /* acosl(|x|>1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsl (x) > 1.0L, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* acos(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 201);
+ }
+
+ return __ieee754_acosl (x);
}
weak_alias (__acosl, acosl)
diff --git a/math/w_asin.c b/math/w_asin.c
index b7fccdea7e..feb5c6aaf3 100644
--- a/math/w_asin.c
+++ b/math/w_asin.c
@@ -1,46 +1,39 @@
-/* @(#)w_asin.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_asin.c,v 1.6 1995/05/10 20:48:35 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper asin(x)
- */
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __asin(double x) /* wrapper asin */
-#else
- double __asin(x) /* wrapper asin */
- double x;
-#endif
+/* wrapper asin */
+double
+__asin (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_asin(x);
-#else
- double z;
- z = __ieee754_asin(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
- if(fabs(x)>1.0) {
- return __kernel_standard(x,x,2); /* asin(|x|>1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabs (x) > 1.0, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* asin(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 2);
+ }
+
+ return __ieee754_asin (x);
}
weak_alias (__asin, asin)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_asinf.c b/math/w_asinf.c
index f2c0b22e4a..1a21dc389a 100644
--- a/math/w_asinf.c
+++ b/math/w_asinf.c
@@ -1,49 +1,38 @@
-/* w_asinf.c -- float version of w_asin.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_asinf.c,v 1.3 1995/05/10 20:48:37 jtc Exp $";
-#endif
-
-/*
- * wrapper asinf(x)
- */
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __asinf(float x) /* wrapper asinf */
-#else
- float __asinf(x) /* wrapper asinf */
- float x;
-#endif
+/* wrapper asinf */
+float
+__asinf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_asinf(x);
-#else
- float z;
- z = __ieee754_asinf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(fabsf(x)>(float)1.0) {
- /* asinf(|x|>1) */
- return (float)__kernel_standard((double)x,(double)x,102);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) > 1.0f, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* asin(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 102);
+ }
+
+ return __ieee754_asinf (x);
}
weak_alias (__asinf, asinf)
diff --git a/math/w_asinl.c b/math/w_asinl.c
index 9a316b77cd..a9f14fbd63 100644
--- a/math/w_asinl.c
+++ b/math/w_asinl.c
@@ -1,49 +1,38 @@
-/* w_asinl.c -- long double version of w_asin.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper asinl(x)
- */
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __asinl(long double x) /* wrapper asinl */
-#else
- long double __asinl(x) /* wrapper asinl */
- long double x;
-#endif
+/* wrapper asinl */
+long double
+__asinl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_asinl(x);
-#else
- long double z;
- z = __ieee754_asinl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(fabsl(x)>1.0) {
- return __kernel_standard(x,x,202); /* asinl(|x|>1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsl (x) > 1.0L, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* asin(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 202);
+ }
+
+ return __ieee754_asinl (x);
}
weak_alias (__asinl, asinl)
diff --git a/math/w_atan2.c b/math/w_atan2.c
index 4fcaba920b..7d61c7279e 100644
--- a/math/w_atan2.c
+++ b/math/w_atan2.c
@@ -1,18 +1,21 @@
-/* @(#)w_atan2.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atan2.c,v 1.6 1995/05/10 20:48:39 jtc Exp $";
-#endif
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
/*
* wrapper atan2(y,x)
@@ -22,23 +25,13 @@ static char rcsid[] = "$NetBSD: w_atan2.c,v 1.6 1995/05/10 20:48:39 jtc Exp $";
#include <math_private.h>
-#ifdef __STDC__
- double __atan2(double y, double x) /* wrapper atan2 */
-#else
- double __atan2(y,x) /* wrapper atan2 */
- double y,x;
-#endif
+double
+__atan2 (double y, double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atan2(y,x);
-#else
- double z;
- z = __ieee754_atan2(y,x);
- if(_LIB_VERSION != _SVID_||__isnan(x)||__isnan(y)) return z;
- if(x==0.0&&y==0.0)
- return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
- return z;
-#endif
+ if (__builtin_expect (x == 0.0 && y == 0.0, 0) && _LIB_VERSION == _SVID_)
+ return __kernel_standard (y, x, 3); /* atan2(+-0,+-0) */
+
+ return __ieee754_atan2 (y, x);
}
weak_alias (__atan2, atan2)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_atan2f.c b/math/w_atan2f.c
index 2a1ca9cf95..b3c65bfcb7 100644
--- a/math/w_atan2f.c
+++ b/math/w_atan2f.c
@@ -1,21 +1,21 @@
-/* w_atan2f.c -- float version of w_atan2.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atan2f.c,v 1.3 1995/05/10 20:48:42 jtc Exp $";
-#endif
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
/*
* wrapper atan2f(y,x)
@@ -25,22 +25,12 @@ static char rcsid[] = "$NetBSD: w_atan2f.c,v 1.3 1995/05/10 20:48:42 jtc Exp $";
#include <math_private.h>
-#ifdef __STDC__
- float __atan2f(float y, float x) /* wrapper atan2f */
-#else
- float __atan2f(y,x) /* wrapper atan2 */
- float y,x;
-#endif
+float
+__atan2f (float y, float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atan2f(y,x);
-#else
- float z;
- z = __ieee754_atan2f(y,x);
- if(_LIB_VERSION != _SVID_||__isnanf(x)||__isnanf(y)) return z;
- if(x==0.0&&y==0.0)
- return __kernel_standard(y,x,103); /* atan2(+-0,+-0) */
- return z;
-#endif
+ if (__builtin_expect (x == 0.0f && y == 0.0f, 0) && _LIB_VERSION == _SVID_)
+ return __kernel_standard_f (y, x, 103); /* atan2(+-0,+-0) */
+
+ return __ieee754_atan2f (y, x);
}
weak_alias (__atan2f, atan2f)
diff --git a/math/w_atan2l.c b/math/w_atan2l.c
index 85d6f5dd7d..c4854993a5 100644
--- a/math/w_atan2l.c
+++ b/math/w_atan2l.c
@@ -1,22 +1,21 @@
-/* w_atan2l.c -- long double version of w_atan2.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
/*
* wrapper atan2l(y,x)
@@ -26,22 +25,12 @@ static char rcsid[] = "$NetBSD: $";
#include <math_private.h>
-#ifdef __STDC__
- long double __atan2l(long double y, long double x) /* wrapper atan2l */
-#else
- long double __atan2l(y,x) /* wrapper atan2l */
- long double y,x;
-#endif
+long double
+__atan2l (long double y, long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atan2l(y,x);
-#else
- long double z;
- z = __ieee754_atan2l(y,x);
- if(_LIB_VERSION != _SVID_||__isnanl(x)||__isnanl(y)) return z;
- if(x==0.0&&y==0.0)
- return __kernel_standard(y,x,203); /* atan2(+-0,+-0) */
- return z;
-#endif
+ if (__builtin_expect (x == 0.0L && y == 0.0L, 0) && _LIB_VERSION == _SVID_)
+ return __kernel_standard (y, x, 203); /* atan2(+-0,+-0) */
+
+ return __ieee754_atan2l (y, x);
}
weak_alias (__atan2l, atan2l)
diff --git a/math/w_atanh.c b/math/w_atanh.c
index a2dab67a75..61ea0d8754 100644
--- a/math/w_atanh.c
+++ b/math/w_atanh.c
@@ -1,49 +1,37 @@
-/* @(#)w_atanh.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atanh.c,v 1.6 1995/05/10 20:48:43 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper atanh(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __atanh(double x) /* wrapper atanh */
-#else
- double __atanh(x) /* wrapper atanh */
- double x;
-#endif
+/* wrapper atanh */
+double
+__atanh (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atanh(x);
-#else
- double z,y;
- z = __ieee754_atanh(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
- y = fabs(x);
- if(y>=1.0) {
- if(y>1.0)
- return __kernel_standard(x,x,30); /* atanh(|x|>1) */
- else
- return __kernel_standard(x,x,31); /* atanh(|x|==1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabs (x) >= 1.0, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x,
+ fabs (x) > 1.0
+ ? 30 /* atanh(|x|>1) */
+ : 31); /* atanh(|x|==1) */
+
+ return __ieee754_atanh (x);
}
weak_alias (__atanh, atanh)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_atanhf.c b/math/w_atanhf.c
index 41dd2ac33b..fd1dbaeee3 100644
--- a/math/w_atanhf.c
+++ b/math/w_atanhf.c
@@ -1,53 +1,36 @@
-/* w_atanhf.c -- float version of w_atanh.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atanhf.c,v 1.3 1995/05/10 20:48:45 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper atanhf(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __atanhf(float x) /* wrapper atanhf */
-#else
- float __atanhf(x) /* wrapper atanhf */
- float x;
-#endif
+/* wrapper atanhf */
+float
+__atanhf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atanhf(x);
-#else
- float z,y;
- z = __ieee754_atanhf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- y = fabsf(x);
- if(y>=(float)1.0) {
- if(y>(float)1.0)
- /* atanhf(|x|>1) */
- return (float)__kernel_standard((double)x,(double)x,130);
- else
- /* atanhf(|x|==1) */
- return (float)__kernel_standard((double)x,(double)x,131);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) >= 1.0f, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, x,
+ fabsf (x) > 1.0f
+ ? 130 /* atanh(|x|>1) */
+ : 131); /* atanh(|x|==1) */
+
+ return __ieee754_atanhf (x);
}
weak_alias (__atanhf, atanhf)
diff --git a/math/w_atanhl.c b/math/w_atanhl.c
index c61229c345..7c958f1312 100644
--- a/math/w_atanhl.c
+++ b/math/w_atanhl.c
@@ -1,52 +1,36 @@
-/* w_atanhl.c -- long double version of w_atanh.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrapper atanhl(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __atanhl(long double x) /* wrapper atanhl */
-#else
- long double __atanhl(x) /* wrapper atanhl */
- long double x;
-#endif
+/* wrapper atanhl */
+long double
+__atanhl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atanhl(x);
-#else
- long double z,y;
- z = __ieee754_atanhl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- y = fabsl(x);
- if(y>=1.0) {
- if(y>1.0)
- return __kernel_standard(x,x,230); /* atanhl(|x|>1) */
- else
- return __kernel_standard(x,x,231); /* atanhl(|x|==1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsl (x) >= 1.0L, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x,
+ fabsl (x) > 1.0L
+ ? 230 /* atanh(|x|>1) */
+ : 231); /* atanh(|x|==1) */
+
+ return __ieee754_atanhl (x);
}
weak_alias (__atanhl, atanhl)
diff --git a/math/w_cosh.c b/math/w_cosh.c
index 0e27a2da1c..57010781bf 100644
--- a/math/w_cosh.c
+++ b/math/w_cosh.c
@@ -1,4 +1,4 @@
-/* @(#)w_cosh.c 5.1 93/09/24 */
+/* Optimizations bu Ulrich Drepper <drepper@gmail.com>, 2011 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $";
-#endif
-
/*
* wrapper cosh(x)
*/
@@ -21,24 +17,15 @@ static char rcsid[] = "$NetBSD: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __cosh(double x) /* wrapper cosh */
-#else
- double __cosh(x) /* wrapper cosh */
- double x;
-#endif
+double
+__cosh (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_cosh(x);
-#else
- double z;
- z = __ieee754_cosh(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
- if(!__finite(z) && __finite(x)) {
- return __kernel_standard(x,x,5); /* cosh overflow */
- } else
- return z;
-#endif
+ double z = __ieee754_cosh (x);
+ if (__builtin_expect (!__finite (z), 0) && __finite (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 5); /* cosh overflow */
+
+ return z;
}
weak_alias (__cosh, cosh)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_coshf.c b/math/w_coshf.c
index 5e3477fdb7..df1f681205 100644
--- a/math/w_coshf.c
+++ b/math/w_coshf.c
@@ -1,5 +1,6 @@
/* w_coshf.c -- float version of w_cosh.c.
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ * Optimizations by Ulrich Drepper <drepper@gmail.com>, 2011.
*/
/*
@@ -8,40 +9,26 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_coshf.c,v 1.3 1995/05/10 20:48:49 jtc Exp $";
-#endif
-
-/*
+/*
* wrapper coshf(x)
*/
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __coshf(float x) /* wrapper coshf */
-#else
- float __coshf(x) /* wrapper coshf */
- float x;
-#endif
+float
+__coshf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_coshf(x);
-#else
- float z;
- z = __ieee754_coshf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(!__finite(z) && __finite(x)) {
- /* cosh overflow */
- return (float)__kernel_standard((double)x,(double)x,105);
- } else
- return z;
-#endif
+ float z = __ieee754_coshf (x);
+ if (__builtin_expect (!__finitef (z), 0) && __finitef (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, x, 105); /* cosh overflow */
+
+ return z;
}
weak_alias (__coshf, coshf)
diff --git a/math/w_coshl.c b/math/w_coshl.c
index ecba921072..abca8b05f5 100644
--- a/math/w_coshl.c
+++ b/math/w_coshl.c
@@ -1,6 +1,7 @@
/* w_acoshl.c -- long double version of w_acosh.c.
* Conversion to long double by Ulrich Drepper,
* Cygnus Support, drepper@cygnus.com.
+ * Optimizations bu Ulrich Drepper <drepper@gmail.com>, 2011.
*/
/*
@@ -14,10 +15,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/*
* wrapper coshl(x)
*/
@@ -25,23 +22,14 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __coshl(long double x) /* wrapper coshl */
-#else
- long double __coshl(x) /* wrapper coshl */
- long double x;
-#endif
+long double
+__coshl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_coshl(x);
-#else
- long double z;
- z = __ieee754_coshl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(!__finitel(z) && __finitel(x)) {
- return __kernel_standard(x,x,205); /* cosh overflow */
- } else
- return z;
-#endif
+ long double z = __ieee754_coshl (x);
+ if (__builtin_expect (!__finitel (z), 0) && __finitel (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 205); /* cosh overflow */
+
+ return z;
}
weak_alias (__coshl, coshl)
diff --git a/math/w_exp10.c b/math/w_exp10.c
index 1512cc0a34..830b08df1e 100644
--- a/math/w_exp10.c
+++ b/math/w_exp10.c
@@ -1,17 +1,22 @@
-/* @(#)w_exp10.c
- * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
/*
* wrapper exp10(x)
@@ -20,25 +25,16 @@
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __exp10(double x) /* wrapper exp10 */
-#else
- double __exp10(x) /* wrapper exp10 */
- double x;
-#endif
+double
+__exp10 (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_exp10(x);
-#else
- double z;
- z = __ieee754_exp10(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finite(z) && __finite(x)) {
- /* exp10 overflow (46) if x > 0, underflow (47) if x < 0. */
- return __kernel_standard(x,x,46+!!__signbit(x));
- }
- return z;
-#endif
+ double z = __ieee754_exp10 (x);
+ if (__builtin_expect (!__finite (z), 0)
+ && __finite (x) && _LIB_VERSION != _IEEE_)
+ /* exp10 overflow (46) if x > 0, underflow (47) if x < 0. */
+ return __kernel_standard (x, x, 46 + !!__signbit (x));
+
+ return z;
}
weak_alias (__exp10, exp10)
strong_alias (__exp10, __pow10)
diff --git a/math/w_exp10f.c b/math/w_exp10f.c
index dcc8dc768e..6fd52f9a3e 100644
--- a/math/w_exp10f.c
+++ b/math/w_exp10f.c
@@ -1,45 +1,40 @@
-/* w_exp10f.c -- float version of w_exp10.c.
- * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
/*
- * wrapper expf10(x)
+ * wrapper exp10f(x)
*/
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __exp10f(float x) /* wrapper exp10f */
-#else
- float __exp10f(x) /* wrapper exp10f */
- float x;
-#endif
+float
+__exp10f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_exp10f(x);
-#else
- float z;
- z = __ieee754_exp10f(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finitef(z) && __finitef(x)) {
- /* exp10f overflow (146) if x > 0, underflow (147) if x < 0. */
- return (float)__kernel_standard((double) x, (double) x,
- 146+!!__signbitf(x));
- }
- return z;
-#endif
+ float z = __ieee754_exp10f (x);
+ if (__builtin_expect (!__finitef (z), 0)
+ && __finitef (x) && _LIB_VERSION != _IEEE_)
+ /* exp10f overflow (146) if x > 0, underflow (147) if x < 0. */
+ return __kernel_standard_f (x, x, 146 + !!__signbitf (x));
+
+ return z;
}
weak_alias (__exp10f, exp10f)
strong_alias (__exp10f, __pow10f)
diff --git a/math/w_exp10l.c b/math/w_exp10l.c
index 80e720a205..0cda27c76b 100644
--- a/math/w_exp10l.c
+++ b/math/w_exp10l.c
@@ -1,18 +1,22 @@
-/* w_exp10l.c -- long double version of w_exp10.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
/*
* wrapper exp10l(x)
@@ -21,25 +25,16 @@
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __exp10l(long double x) /* wrapper exp10 */
-#else
- long double __exp10l(x) /* wrapper exp10 */
- long double x;
-#endif
+long double
+__exp10l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_exp10l(x);
-#else
- long double z;
- z = __ieee754_exp10l(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finitel(z) && __finitel(x)) {
- /* exp10 overflow (246) if x > 0, underflow (247) if x < 0. */
- return __kernel_standard(x,x,246+__signbitl(x));
- }
- return z;
-#endif
+ long double z = __ieee754_exp10l (x);
+ if (__builtin_expect (!__finitel (z), 0)
+ && __finitel (x) && _LIB_VERSION != _IEEE_)
+ /* exp10l overflow (246) if x > 0, underflow (247) if x < 0. */
+ return __kernel_standard (x, x, 246 + !!__signbitl (x));
+
+ return z;
}
weak_alias (__exp10l, exp10l)
strong_alias (__exp10l, __pow10l)
diff --git a/math/w_exp2.c b/math/w_exp2.c
index c92fb52ad0..bf223265cb 100644
--- a/math/w_exp2.c
+++ b/math/w_exp2.c
@@ -6,28 +6,18 @@
#include <math.h>
#include <math_private.h>
-static const double o_threshold= (double) DBL_MAX_EXP;
-static const double u_threshold= (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
+static const double o_threshold = (double) DBL_MAX_EXP;
+static const double u_threshold = (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
double
-__exp2 (double x) /* wrapper exp2 */
+__exp2 (double x)
{
-#ifdef _IEEE_LIBM
+ if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
+ && _LIB_VERSION != _IEEE_ && __finite (x))
+ /* exp2 overflow: 44, exp2 underflow: 45 */
+ return __kernel_standard (x, x, 44 + (x <= o_threshold));
+
return __ieee754_exp2 (x);
-#else
- double z;
- z = __ieee754_exp2 (x);
- if (_LIB_VERSION != _IEEE_ && __finite (x))
- {
- if (x > o_threshold)
- /* exp2 overflow */
- return __kernel_standard (x, x, 44);
- else if (x <= u_threshold)
- /* exp2 underflow */
- return __kernel_standard (x, x, 45);
- }
- return z;
-#endif
}
weak_alias (__exp2, exp2)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_exp2f.c b/math/w_exp2f.c
index 94c82e206e..7215fcaf4c 100644
--- a/math/w_exp2f.c
+++ b/math/w_exp2f.c
@@ -6,27 +6,17 @@
#include <math.h>
#include <math_private.h>
-static const float o_threshold= (float) FLT_MAX_EXP;
-static const float u_threshold= (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1);
+static const float o_threshold = (float) FLT_MAX_EXP;
+static const float u_threshold = (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1);
float
-__exp2f (float x) /* wrapper exp2f */
+__exp2f (float x)
{
-#ifdef _IEEE_LIBM
+ if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
+ && _LIB_VERSION != _IEEE_ && __finitef (x))
+ /* exp2 overflow: 144, exp2 underflow: 145 */
+ return __kernel_standard_f (x, x, 144 + (x <= o_threshold));
+
return __ieee754_exp2f (x);
-#else
- float z;
- z = __ieee754_exp2f (x);
- if (_LIB_VERSION != _IEEE_ && __finitef (x))
- {
- if (x > o_threshold)
- /* exp2 overflow */
- return (float) __kernel_standard ((double) x, (double) x, 144);
- else if (x <= u_threshold)
- /* exp2 underflow */
- return (float) __kernel_standard ((double) x, (double) x, 145);
- }
- return z;
-#endif
}
weak_alias (__exp2f, exp2f)
diff --git a/math/w_exp2l.c b/math/w_exp2l.c
index f54e3946d8..ac8d231e2c 100644
--- a/math/w_exp2l.c
+++ b/math/w_exp2l.c
@@ -11,21 +11,13 @@ static const long double u_threshold
= (long double) (LDBL_MIN_EXP - LDBL_MANT_DIG - 1);
long double
-__exp2l (long double x) /* wrapper exp2l */
+__exp2l (long double x)
{
-#ifdef _IEEE_LIBM
+ if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
+ && _LIB_VERSION != _IEEE_ && __finitel (x))
+ /* exp2 overflow: 244, exp2 underflow: 245 */
+ return __kernel_standard (x, x, 244 + (x <= o_threshold));
+
return __ieee754_exp2l (x);
-#else
- long double z;
- z = __ieee754_exp2l (x);
- if (_LIB_VERSION != _IEEE_ && __finitel (x))
- {
- if (x > o_threshold)
- return __kernel_standard (x, x, 244); /* exp2l overflow */
- else if (x <= u_threshold)
- return __kernel_standard (x, x, 245); /* exp2l underflow */
- }
- return z;
-#endif
}
weak_alias (__exp2l, exp2l)
diff --git a/math/w_fmod.c b/math/w_fmod.c
index b93ff8935e..d38ae8c5aa 100644
--- a/math/w_fmod.c
+++ b/math/w_fmod.c
@@ -1,46 +1,35 @@
-/* @(#)w_fmod.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper fmod(x,y)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-
-#ifdef __STDC__
- double __fmod(double x, double y) /* wrapper fmod */
-#else
- double __fmod(x,y) /* wrapper fmod */
- double x,y;
-#endif
+/* wrapper fmod */
+double
+__fmod (double x, double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_fmod(x,y);
-#else
- double z;
- z = __ieee754_fmod(x,y);
- if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z;
- if(__isinf_ns(x)||y==0.0) {
- /* fmod(+-Inf,y) or fmod(x,0) */
- return __kernel_standard(x,y,27);
- } else
- return z;
-#endif
+ if (__builtin_expect (__isinf_ns (x) || y == 0.0, 0)
+ && _LIB_VERSION != _IEEE_ && !__isnan (y) && !__isnan (x))
+ /* fmod(+-Inf,y) or fmod(x,0) */
+ return __kernel_standard (x, y, 27);
+
+ return __ieee754_fmod (x, y);
}
weak_alias (__fmod, fmod)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_fmodf.c b/math/w_fmodf.c
index 12e2fb3cf8..c0370cf6f3 100644
--- a/math/w_fmodf.c
+++ b/math/w_fmodf.c
@@ -1,48 +1,34 @@
-/* w_fmodf.c -- float version of w_fmod.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper fmodf(x,y)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-
-#ifdef __STDC__
- float __fmodf(float x, float y) /* wrapper fmodf */
-#else
- float __fmodf(x,y) /* wrapper fmodf */
- float x,y;
-#endif
+/* wrapper fmodf */
+float
+__fmodf (float x, float y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_fmodf(x,y);
-#else
- float z;
- z = __ieee754_fmodf(x,y);
- if(_LIB_VERSION == _IEEE_ ||__isnanf(y)||__isnanf(x)) return z;
- if(__isinf_nsf(x)||y==(float)0.0) {
- /* fmodf(+-Inf,y) or fmodf(x,0) */
- return (float)__kernel_standard((double)x,(double)y,127);
- } else
- return z;
-#endif
+ if (__builtin_expect (__isinf_nsf (x) || y == 0.0f, 0)
+ && _LIB_VERSION != _IEEE_ && !__isnanf (y) && !__isnanf (x))
+ /* fmod(+-Inf,y) or fmod(x,0) */
+ return __kernel_standard_f (x, y, 127);
+
+ return __ieee754_fmodf (x, y);
}
weak_alias (__fmodf, fmodf)
diff --git a/math/w_fmodl.c b/math/w_fmodl.c
index ffc77adf09..d236fb9fdb 100644
--- a/math/w_fmodl.c
+++ b/math/w_fmodl.c
@@ -1,49 +1,34 @@
-/* w_fmodl.c -- long double version of w_fmod.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrapper fmodl(x,y)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-
-#ifdef __STDC__
- long double __fmodl(long double x, long double y)/* wrapper fmodl */
-#else
- long double __fmodl(x,y) /* wrapper fmodl */
- long double x,y;
-#endif
+/* wrapper fmodl */
+long double
+__fmodl (long double x, long double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_fmodl(x,y);
-#else
- long double z;
- z = __ieee754_fmodl(x,y);
- if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z;
- if(__isinf_nsl(x)||y==0.0) {
- /* fmodl(+-Inf,y) or fmodl(x,0) */
- return __kernel_standard(x,y,227);
- } else
- return z;
-#endif
+ if (__builtin_expect (__isinf_nsl (x) || y == 0.0L, 0)
+ && _LIB_VERSION != _IEEE_ && !__isnanl (y) && !__isnanl (x))
+ /* fmod(+-Inf,y) or fmod(x,0) */
+ return __kernel_standard (x, y, 227);
+
+ return __ieee754_fmodl (x, y);
}
weak_alias (__fmodl, fmodl)
diff --git a/math/w_hypot.c b/math/w_hypot.c
index df69ed383b..2c6de28600 100644
--- a/math/w_hypot.c
+++ b/math/w_hypot.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $";
-#endif
-
/*
* wrapper hypot(x,y)
*/
@@ -22,24 +18,15 @@ static char rcsid[] = "$NetBSD: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $";
#include <math_private.h>
-#ifdef __STDC__
- double __hypot(double x, double y)/* wrapper hypot */
-#else
- double __hypot(x,y) /* wrapper hypot */
- double x,y;
-#endif
+double
+__hypot (double x, double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_hypot(x,y);
-#else
- double z;
- z = __ieee754_hypot(x,y);
- if(_LIB_VERSION == _IEEE_) return z;
- if((!__finite(z))&&__finite(x)&&__finite(y))
- return __kernel_standard(x,y,4); /* hypot overflow */
- else
- return z;
-#endif
+ double z = __ieee754_hypot(x,y);
+ if(__builtin_expect(!__finite(z), 0)
+ && __finite(x) && __finite(y) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, y, 4); /* hypot overflow */
+
+ return z;
}
weak_alias (__hypot, hypot)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_hypotf.c b/math/w_hypotf.c
index e1f074f75e..6042b8802d 100644
--- a/math/w_hypotf.c
+++ b/math/w_hypotf.c
@@ -8,15 +8,11 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_hypotf.c,v 1.3 1995/05/10 20:49:09 jtc Exp $";
-#endif
-
/*
* wrapper hypotf(x,y)
*/
@@ -25,24 +21,15 @@ static char rcsid[] = "$NetBSD: w_hypotf.c,v 1.3 1995/05/10 20:49:09 jtc Exp $";
#include <math_private.h>
-#ifdef __STDC__
- float __hypotf(float x, float y) /* wrapper hypotf */
-#else
- float __hypotf(x,y) /* wrapper hypotf */
- float x,y;
-#endif
+float
+__hypotf(float x, float y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_hypotf(x,y);
-#else
- float z;
- z = __ieee754_hypotf(x,y);
- if(_LIB_VERSION == _IEEE_) return z;
- if((!__finitef(z))&&__finitef(x)&&__finitef(y))
+ float z = __ieee754_hypotf(x,y);
+ if(__builtin_expect(!__finitef(z), 0)
+ && __finitef(x) && __finitef(y) && _LIB_VERSION != _IEEE_)
/* hypot overflow */
- return (float)__kernel_standard((double)x,(double)y,104);
- else
- return z;
-#endif
+ return __kernel_standard_f(x, y, 104);
+
+ return z;
}
weak_alias (__hypotf, hypotf)
diff --git a/math/w_hypotl.c b/math/w_hypotl.c
index 6b6414da22..522eb63c39 100644
--- a/math/w_hypotl.c
+++ b/math/w_hypotl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/*
* wrapper hypotl(x,y)
*/
@@ -26,23 +22,15 @@ static char rcsid[] = "$NetBSD: $";
#include <math_private.h>
-#ifdef __STDC__
- long double __hypotl(long double x, long double y)/* wrapper hypotl */
-#else
- long double __hypotl(x,y) /* wrapper hypotl */
- long double x,y;
-#endif
+long double
+__hypotl(long double x, long double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_hypotl(x,y);
-#else
long double z;
z = __ieee754_hypotl(x,y);
- if(_LIB_VERSION == _IEEE_) return z;
- if((!__finitel(z))&&__finitel(x)&&__finitel(y))
- return __kernel_standard(x,y,204); /* hypot overflow */
- else
- return z;
-#endif
+ if(__builtin_expect(!__finitel(z), 0)
+ && __finitel(x) && __finitel(y) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, y, 204); /* hypot overflow */
+
+ return z;
}
weak_alias (__hypotl, hypotl)
diff --git a/math/w_j0.c b/math/w_j0.c
index 59b6b66d0a..361352048c 100644
--- a/math/w_j0.c
+++ b/math/w_j0.c
@@ -1,75 +1,63 @@
-/* @(#)w_j0.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j0.c,v 1.6 1995/05/10 20:49:11 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper j0(double x), y0(double x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double j0(double x) /* wrapper j0 */
-#else
- double j0(x) /* wrapper j0 */
- double x;
-#endif
+
+/* wrapper j0 */
+double
+j0 (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_j0(x);
-#else
- double z = __ieee754_j0(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
- if(fabs(x)>X_TLOSS) {
- return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabs (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* j0(|x|>X_TLOSS) */
+ return __kernel_standard (x, x, 34);
+
+ return __ieee754_j0 (x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (j0, j0l)
#endif
-#ifdef __STDC__
- double y0(double x) /* wrapper y0 */
-#else
- double y0(x) /* wrapper y0 */
- double x;
-#endif
+/* wrapper y0 */
+double
+y0 (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_y0(x);
-#else
- double z;
- z = __ieee754_y0(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
- if(x <= 0.0){
- if(x==0.0)
- /* d= -one/(x-x); */
- return __kernel_standard(x,x,8);
- else
- /* d = zero/(x-x); */
- return __kernel_standard(x,x,9);
- }
- if(x>X_TLOSS) {
- return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0 || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 9);
+ }
+ else if (x == 0.0)
+ /* d = -one/(x-x) */
+ return __kernel_standard (x, x, 8);
+ else
+ /* y0(x>X_TLOSS) */
+ return __kernel_standard (x, x, 35);
+ }
+
+ return __ieee754_y0 (x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (y0, y0l)
diff --git a/math/w_j0f.c b/math/w_j0f.c
index dd436fff59..ff1ac3ca3d 100644
--- a/math/w_j0f.c
+++ b/math/w_j0f.c
@@ -1,74 +1,60 @@
-/* w_j0f.c -- float version of w_j0.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j0f.c,v 1.3 1995/05/10 20:49:13 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper j0f(float x), y0f(float x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float j0f(float x) /* wrapper j0f */
-#else
- float j0f(x) /* wrapper j0f */
- float x;
-#endif
+
+/* wrapper j0f */
+float
+j0f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_j0f(x);
-#else
- float z = __ieee754_j0f(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(fabsf(x)>(float)X_TLOSS) {
- /* j0f(|x|>X_TLOSS) */
- return (float)__kernel_standard((double)x,(double)x,134);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) > (float) X_TLOSS, 0)
+ && _LIB_VERSION != _IEEE_)
+ /* j0(|x|>X_TLOSS) */
+ return __kernel_standard_f (x, x, 134);
+
+ return __ieee754_j0f (x);
}
-#ifdef __STDC__
- float y0f(float x) /* wrapper y0f */
-#else
- float y0f(x) /* wrapper y0f */
- float x;
-#endif
+
+/* wrapper y0f */
+float
+y0f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_y0f(x);
-#else
- float z;
- z = __ieee754_y0f(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
- if(x <= (float)0.0){
- if(x==(float)0.0)
- /* d= -one/(x-x); */
- return (float)__kernel_standard((double)x,(double)x,108);
- else
- /* d = zero/(x-x); */
- return (float)__kernel_standard((double)x,(double)x,109);
- }
- if(x>(float)X_TLOSS) {
- /* y0(x>X_TLOSS) */
- return (float)__kernel_standard((double)x,(double)x,135);
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0f || x > (float) X_TLOSS, 0)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0f)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 109);
+ }
+ else if (x == 0.0f)
+ /* d = -one/(x-x) */
+ return __kernel_standard_f (x, x, 108);
+ else
+ /* y0(x>X_TLOSS) */
+ return __kernel_standard_f (x, x, 135);
+ }
+
+ return __ieee754_y0f (x);
}
diff --git a/math/w_j0l.c b/math/w_j0l.c
index a91457d374..a16363d53a 100644
--- a/math/w_j0l.c
+++ b/math/w_j0l.c
@@ -1,76 +1,60 @@
-/* w_j0l.c -- long double version of w_j0.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrapper j0l(long double x), y0l(long double x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __j0l(long double x) /* wrapper j0l */
-#else
- long double __j0l(x) /* wrapper j0 */
- long double x;
-#endif
+
+/* wrapper j0l */
+long double
+__j0l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_j0l(x);
-#else
- long double z = __ieee754_j0l(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(fabsl(x)>X_TLOSS) {
- return __kernel_standard(x,x,234); /* j0(|x|>X_TLOSS) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsl (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* j0(|x|>X_TLOSS) */
+ return __kernel_standard (x, x, 234);
+
+ return __ieee754_j0l (x);
}
weak_alias (__j0l, j0l)
-#ifdef __STDC__
- long double __y0l(long double x) /* wrapper y0l */
-#else
- long double __y0l(x) /* wrapper y0 */
- long double x;
-#endif
+
+/* wrapper y0l */
+long double
+__y0l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_y0l(x);
-#else
- long double z;
- z = __ieee754_y0l(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
- if(x <= 0.0){
- if(x==0.0)
- /* d= -one/(x-x); */
- return __kernel_standard(x,x,208);
- else
- /* d = zero/(x-x); */
- return __kernel_standard(x,x,209);
- }
- if(x>X_TLOSS) {
- return __kernel_standard(x,x,235); /* y0(x>X_TLOSS) */
- } else
- return z;
-#endif
-}
+ if (__builtin_expect (x <= 0.0L || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0L)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 209);
+ }
+ else if (x == 0.0L)
+ /* d = -one/(x-x) */
+ return __kernel_standard (x, x, 208);
+ else
+ /* y0(x>X_TLOSS) */
+ return __kernel_standard (x, x, 235);
+ }
+ return __ieee754_y0l (x);
+}
weak_alias (__y0l, y0l)
diff --git a/math/w_j1.c b/math/w_j1.c
index 7bb3208a74..09cacb82c5 100644
--- a/math/w_j1.c
+++ b/math/w_j1.c
@@ -1,76 +1,63 @@
-/* @(#)w_j1.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j1.c,v 1.6 1995/05/10 20:49:15 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper of j1,y1
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double j1(double x) /* wrapper j1 */
-#else
- double j1(x) /* wrapper j1 */
- double x;
-#endif
+
+/* wrapper j1 */
+double
+j1 (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_j1(x);
-#else
- double z;
- z = __ieee754_j1(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
- if(fabs(x)>X_TLOSS) {
- return __kernel_standard(x,x,36); /* j1(|x|>X_TLOSS) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabs (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* j1(|x|>X_TLOSS) */
+ return __kernel_standard (x, x, 36);
+
+ return __ieee754_j1 (x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (j1, j1l)
#endif
-#ifdef __STDC__
- double y1(double x) /* wrapper y1 */
-#else
- double y1(x) /* wrapper y1 */
- double x;
-#endif
+/* wrapper y1 */
+double
+y1 (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_y1(x);
-#else
- double z;
- z = __ieee754_y1(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
- if(x <= 0.0){
- if(x==0.0)
- /* d= -one/(x-x); */
- return __kernel_standard(x,x,10);
- else
- /* d = zero/(x-x); */
- return __kernel_standard(x,x,11);
- }
- if(x>X_TLOSS) {
- return __kernel_standard(x,x,37); /* y1(x>X_TLOSS) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0 || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 11);
+ }
+ else if (x == 0.0)
+ /* d = -one/(x-x) */
+ return __kernel_standard (x, x, 10);
+ else
+ /* y1(x>X_TLOSS) */
+ return __kernel_standard (x, x, 37);
+ }
+
+ return __ieee754_y1 (x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (y1, y1l)
diff --git a/math/w_j1f.c b/math/w_j1f.c
index 43dfc6142e..40a2cf3022 100644
--- a/math/w_j1f.c
+++ b/math/w_j1f.c
@@ -1,75 +1,59 @@
-/* w_j1f.c -- float version of w_j1.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j1f.c,v 1.3 1995/05/10 20:49:17 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper of j1f,y1f
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float j1f(float x) /* wrapper j1f */
-#else
- float j1f(x) /* wrapper j1f */
- float x;
-#endif
+
+/* wrapper j1f */
+float
+j1f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_j1f(x);
-#else
- float z;
- z = __ieee754_j1f(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
- if(fabsf(x)>(float)X_TLOSS) {
- /* j1(|x|>X_TLOSS) */
- return (float)__kernel_standard((double)x,(double)x,136);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* j1(|x|>X_TLOSS) */
+ return __kernel_standard_f (x, x, 136);
+
+ return __ieee754_j1f (x);
}
-#ifdef __STDC__
- float y1f(float x) /* wrapper y1f */
-#else
- float y1f(x) /* wrapper y1f */
- float x;
-#endif
+
+/* wrapper y1f */
+float
+y1f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_y1f(x);
-#else
- float z;
- z = __ieee754_y1f(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
- if(x <= (float)0.0){
- if(x==(float)0.0)
- /* d= -one/(x-x); */
- return (float)__kernel_standard((double)x,(double)x,110);
- else
- /* d = zero/(x-x); */
- return (float)__kernel_standard((double)x,(double)x,111);
- }
- if(x>(float)X_TLOSS) {
- /* y1(x>X_TLOSS) */
- return (float)__kernel_standard((double)x,(double)x,137);
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0f || x > (float) X_TLOSS, 0)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0f)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 111);
+ }
+ else if (x == 0.0f)
+ /* d = -one/(x-x) */
+ return __kernel_standard_f (x, x, 110);
+ else
+ /* y1(x>X_TLOSS) */
+ return __kernel_standard_f (x, x, 137);
+ }
+
+ return __ieee754_y1f (x);
}
diff --git a/math/w_j1l.c b/math/w_j1l.c
index d0522953da..91b56e332c 100644
--- a/math/w_j1l.c
+++ b/math/w_j1l.c
@@ -1,76 +1,60 @@
-/* w_j1l.c -- long double version of w_j1.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrapper of j1l,y1l
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __j1l(long double x) /* wrapper j1l */
-#else
- long double __j1l(x) /* wrapper j1l */
- long double x;
-#endif
+
+/* wrapper j1l */
+long double
+__j1l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_j1l(x);
-#else
- long double z;
- z = __ieee754_j1l(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
- if(fabsl(x)>X_TLOSS) {
- return __kernel_standard(x,x,236); /* j1(|x|>X_TLOSS) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsl (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* j1(|x|>X_TLOSS) */
+ return __kernel_standard (x, x, 236);
+
+ return __ieee754_j1l (x);
}
weak_alias (__j1l, j1l)
-#ifdef __STDC__
- long double __y1l(long double x) /* wrapper y1l */
-#else
- long double __y1l(x) /* wrapper y1l */
- long double x;
-#endif
+
+/* wrapper y1l */
+long double
+__y1l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_y1l(x);
-#else
- long double z;
- z = __ieee754_y1l(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
- if(x <= 0.0){
- if(x==0.0)
- /* d= -one/(x-x); */
- return __kernel_standard(x,x,210);
- else
- /* d = zero/(x-x); */
- return __kernel_standard(x,x,211);
- }
- if(x>X_TLOSS) {
- return __kernel_standard(x,x,237); /* y1(x>X_TLOSS) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0L || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0L)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 211);
+ }
+ else if (x == 0.0L)
+ /* d = -one/(x-x) */
+ return __kernel_standard (x, x, 210);
+ else
+ /* y1(x>X_TLOSS) */
+ return __kernel_standard (x, x, 237);
+ }
+
+ return __ieee754_y1l (x);
}
weak_alias (__y1l, y1l)
diff --git a/math/w_jn.c b/math/w_jn.c
index 41ec8b32d4..36fb448163 100644
--- a/math/w_jn.c
+++ b/math/w_jn.c
@@ -1,98 +1,63 @@
-/* @(#)w_jn.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper jn(int n, double x), yn(int n, double x)
- * floating point Bessel's function of the 1st and 2nd kind
- * of order n
- *
- * Special cases:
- * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
- * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
- * Note 2. About jn(n,x), yn(n,x)
- * For n=0, j0(x) is called,
- * for n=1, j1(x) is called,
- * for n<x, forward recursion us used starting
- * from values of j0(x) and j1(x).
- * for n>x, a continued fraction approximation to
- * j(n,x)/j(n-1,x) is evaluated and then backward
- * recursion is used starting from a supposed value
- * for j(n,x). The resulting value of j(0,x) is
- * compared with the actual value to correct the
- * supposed value of j(n,x).
- *
- * yn(n,x) is similar in all respects, except
- * that forward recursion is used for all
- * values of n>1.
- *
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double jn(int n, double x) /* wrapper jn */
-#else
- double jn(n,x) /* wrapper jn */
- double x; int n;
-#endif
+
+/* wrapper jn */
+double
+jn (int n, double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_jn(n,x);
-#else
- double z;
- z = __ieee754_jn(n,x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
- if(fabs(x)>X_TLOSS) {
- return __kernel_standard((double)n,x,38); /* jn(|x|>X_TLOSS,n) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabs (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* jn(n,|x|>X_TLOSS) */
+ return __kernel_standard (n, x, 38);
+
+ return __ieee754_jn (n, x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (jn, jnl)
#endif
-#ifdef __STDC__
- double yn(int n, double x) /* wrapper yn */
-#else
- double yn(n,x) /* wrapper yn */
- double x; int n;
-#endif
+/* wrapper yn */
+double
+yn (int n, double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_yn(n,x);
-#else
- double z;
- z = __ieee754_yn(n,x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
- if(x <= 0.0){
- if(x==0.0)
- /* d= -one/(x-x); */
- return __kernel_standard((double)n,x,12);
- else
- /* d = zero/(x-x); */
- return __kernel_standard((double)n,x,13);
- }
- if(x>X_TLOSS) {
- return __kernel_standard((double)n,x,39); /* yn(x>X_TLOSS,n) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0 || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (n, x, 13);
+ }
+ else if (x == 0.0)
+ /* d = -one/(x-x) */
+ return __kernel_standard (n, x, 12);
+ else
+ /* yn(n,x>X_TLOSS) */
+ return __kernel_standard (n, x, 39);
+ }
+
+ return __ieee754_yn (n, x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (yn, ynl)
diff --git a/math/w_jnf.c b/math/w_jnf.c
index 0b9a2aabb9..7b359558f1 100644
--- a/math/w_jnf.c
+++ b/math/w_jnf.c
@@ -1,71 +1,60 @@
-/* w_jnf.c -- float version of w_jn.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_jnf.c,v 1.3 1995/05/10 20:49:21 jtc Exp $";
-#endif
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float jnf(int n, float x) /* wrapper jnf */
-#else
- float jnf(n,x) /* wrapper jnf */
- float x; int n;
-#endif
+
+/* wrapper jnf */
+float
+jnf (int n, float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_jnf(n,x);
-#else
- float z;
- z = __ieee754_jnf(n,x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
- if(fabsf(x)>(float)X_TLOSS) {
- /* jn(|x|>X_TLOSS,n) */
- return (float)__kernel_standard((double)n,(double)x,138);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) > (float) X_TLOSS, 0)
+ && _LIB_VERSION != _IEEE_)
+ /* jn(n,|x|>X_TLOSS) */
+ return __kernel_standard_f (n, x, 138);
+
+ return __ieee754_jnf (n, x);
}
-#ifdef __STDC__
- float ynf(int n, float x) /* wrapper ynf */
-#else
- float ynf(n,x) /* wrapper ynf */
- float x; int n;
-#endif
+
+/* wrapper ynf */
+float
+ynf (int n, float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_ynf(n,x);
-#else
- float z;
- z = __ieee754_ynf(n,x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
- if(x <= (float)0.0){
- if(x==(float)0.0)
- /* d= -one/(x-x); */
- return (float)__kernel_standard((double)n,(double)x,112);
- else
- /* d = zero/(x-x); */
- return (float)__kernel_standard((double)n,(double)x,113);
- }
- if(x>(float)X_TLOSS) {
- /* yn(x>X_TLOSS,n) */
- return (float)__kernel_standard((double)n,(double)x,139);
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0f || x > (float) X_TLOSS, 0)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0f)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (n, x, 113);
+ }
+ else if (x == 0.0)
+ /* d = -one/(x-x) */
+ return __kernel_standard_f (n, x, 112);
+ else
+ /* yn(n,x>X_TLOSS) */
+ return __kernel_standard_f (n, x, 139);
+ }
+
+ return __ieee754_ynf (n, x);
}
diff --git a/math/w_lgamma.c b/math/w_lgamma.c
index f76b552be0..17c546059d 100644
--- a/math/w_lgamma.c
+++ b/math/w_lgamma.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgamma.c,v 1.6 1995/05/10 20:49:24 jtc Exp $";
-#endif
-
/* double lgamma(double x)
* Return the logarithm of the Gamma function of x.
*
@@ -23,31 +19,24 @@ static char rcsid[] = "$NetBSD: w_lgamma.c,v 1.6 1995/05/10 20:49:24 jtc Exp $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __lgamma(double x)
-#else
- double __lgamma(x)
- double x;
-#endif
+double
+__lgamma(double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgamma_r(x,&signgam);
-#else
- double y;
int local_signgam = 0;
- y = __ieee754_lgamma_r(x,&local_signgam);
- if (_LIB_VERSION != _ISOC_)
- /* ISO C99 does not define the global variable. */
- signgam = local_signgam;
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finite(y)&&__finite(x)) {
- if(__floor(x)==x&&x<=0.0)
- return __kernel_standard(x,x,15); /* lgamma pole */
- else
- return __kernel_standard(x,x,14); /* lgamma overflow */
- } else
- return y;
-#endif
+ double y = __ieee754_lgamma_r(x,
+ _LIB_VERSION != _ISOC_
+ /* ISO C99 does not define the
+ global variable. */
+ ? &signgam
+ : &local_signgam);
+ if(__builtin_expect(!__finite(y), 0)
+ && __finite(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, x,
+ __floor(x)==x&&x<=0.0
+ ? 15 /* lgamma pole */
+ : 14); /* lgamma overflow */
+
+ return y;
}
weak_alias (__lgamma, lgamma)
strong_alias (__lgamma, __gamma)
diff --git a/math/w_lgamma_r.c b/math/w_lgamma_r.c
index bec2c6e20a..9d00f58ab7 100644
--- a/math/w_lgamma_r.c
+++ b/math/w_lgamma_r.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgamma_r.c,v 1.6 1995/05/10 20:49:27 jtc Exp $";
-#endif
-
/*
* wrapper double lgamma_r(double x, int *signgamp)
*/
@@ -22,27 +18,18 @@ static char rcsid[] = "$NetBSD: w_lgamma_r.c,v 1.6 1995/05/10 20:49:27 jtc Exp $
#include <math_private.h>
-#ifdef __STDC__
- double __lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */
-#else
- double __lgamma_r(x,signgamp) /* wrapper lgamma_r */
- double x; int *signgamp;
-#endif
+double
+__lgamma_r(double x, int *signgamp)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgamma_r(x,signgamp);
-#else
- double y;
- y = __ieee754_lgamma_r(x,signgamp);
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finite(y)&&__finite(x)) {
- if(__floor(x)==x&&x<=0.0)
- return __kernel_standard(x,x,15); /* lgamma pole */
- else
- return __kernel_standard(x,x,14); /* lgamma overflow */
- } else
- return y;
-#endif
+ double y = __ieee754_lgamma_r(x,signgamp);
+ if(__builtin_expect(!__finite(y), 0)
+ && __finite(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, x,
+ __floor(x)==x&&x<=0.0
+ ? 15 /* lgamma pole */
+ : 14); /* lgamma overflow */
+
+ return y;
}
weak_alias (__lgamma_r, lgamma_r)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_lgammaf.c b/math/w_lgammaf.c
index 9747e9216a..f3166dfd33 100644
--- a/math/w_lgammaf.c
+++ b/math/w_lgammaf.c
@@ -13,40 +13,27 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgammaf.c,v 1.3 1995/05/10 20:49:30 jtc Exp $";
-#endif
-
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __lgammaf(float x)
-#else
- float __lgammaf(x)
- float x;
-#endif
+float
+__lgammaf(float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgammaf_r(x,&signgam);
-#else
- float y;
int local_signgam = 0;
- y = __ieee754_lgammaf_r(x,&local_signgam);
- if (_LIB_VERSION != _ISOC_)
- /* ISO C99 does not define the global variable. */
- signgam = local_signgam;
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finitef(y)&&__finitef(x)) {
- if(__floorf(x)==x&&x<=(float)0.0)
- /* lgamma pole */
- return (float)__kernel_standard((double)x,(double)x,115);
- else
- /* lgamma overflow */
- return (float)__kernel_standard((double)x,(double)x,114);
- } else
- return y;
-#endif
+ float y = __ieee754_lgammaf_r(x,
+ _LIB_VERSION != _ISOC_
+ /* ISO C99 does not define the
+ global variable. */
+ ? &signgam
+ : &local_signgam);
+ if(__builtin_expect(!__finitef(y), 0)
+ && __finitef(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f(x, x,
+ __floorf(x)==x&&x<=0.0f
+ ? 115 /* lgamma pole */
+ : 114); /* lgamma overflow */
+
+ return y;
}
weak_alias (__lgammaf, lgammaf)
strong_alias (__lgammaf, __gammaf)
diff --git a/math/w_lgammaf_r.c b/math/w_lgammaf_r.c
index 3758fa0d06..683fe72dc6 100644
--- a/math/w_lgammaf_r.c
+++ b/math/w_lgammaf_r.c
@@ -8,16 +8,12 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgammaf_r.c,v 1.3 1995/05/10 20:49:32 jtc Exp $";
-#endif
-
-/*
+/*
* wrapper float lgammaf_r(float x, int *signgamp)
*/
@@ -25,28 +21,17 @@ static char rcsid[] = "$NetBSD: w_lgammaf_r.c,v 1.3 1995/05/10 20:49:32 jtc Exp
#include <math_private.h>
-#ifdef __STDC__
- float __lgammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
-#else
- float __lgammaf_r(x,signgamp) /* wrapper lgammaf_r */
- float x; int *signgamp;
-#endif
+float
+__lgammaf_r(float x, int *signgamp)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgammaf_r(x,signgamp);
-#else
- float y;
- y = __ieee754_lgammaf_r(x,signgamp);
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finitef(y)&&__finitef(x)) {
- if(__floorf(x)==x&&x<=(float)0.0)
- /* lgamma pole */
- return (float)__kernel_standard((double)x,(double)x,115);
- else
- /* lgamma overflow */
- return (float)__kernel_standard((double)x,(double)x,114);
- } else
- return y;
-#endif
-}
+ float y = __ieee754_lgammaf_r(x,signgamp);
+ if(__builtin_expect(!__finitef(y), 0)
+ && __finitef(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f(x, x,
+ __floorf(x)==x&&x<=0.0f
+ ? 115 /* lgamma pole */
+ : 114); /* lgamma overflow */
+
+ return y;
+}
weak_alias (__lgammaf_r, lgammaf_r)
diff --git a/math/w_lgammal.c b/math/w_lgammal.c
index 0176243c4a..7df38e761b 100644
--- a/math/w_lgammal.c
+++ b/math/w_lgammal.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* long double lgammal(long double x)
* Return the logarithm of the Gamma function of x.
*
@@ -27,31 +23,24 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __lgammal(long double x)
-#else
- long double __lgammal(x)
- long double x;
-#endif
+long double
+__lgammal(long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgammal_r(x,&signgam);
-#else
- long double y;
int local_signgam = 0;
- y = __ieee754_lgammal_r(x,&local_signgam);
- if (_LIB_VERSION != _ISOC_)
- /* ISO C99 does not define the global variable. */
- signgam = local_signgam;
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finitel(y)&&__finitel(x)) {
- if(__floorl(x)==x&&x<=0.0)
- return __kernel_standard(x,x,215); /* lgamma pole */
- else
- return __kernel_standard(x,x,214); /* lgamma overflow */
- } else
- return y;
-#endif
+ long double y = __ieee754_lgammal_r(x,
+ _LIB_VERSION != _ISOC_
+ /* ISO C99 does not define the
+ global variable. */
+ ? &signgam
+ : &local_signgam);
+ if(__builtin_expect(!__finitel(y), 0)
+ && __finitel(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, x,
+ __floorl(x)==x&&x<=0.0L
+ ? 215 /* lgamma pole */
+ : 214); /* lgamma overflow */
+
+ return y;
}
weak_alias (__lgammal, lgammal)
strong_alias (__lgammal, __gammal)
diff --git a/math/w_lgammal_r.c b/math/w_lgammal_r.c
index baa4f95393..ec3428486a 100644
--- a/math/w_lgammal_r.c
+++ b/math/w_lgammal_r.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/*
* wrapper long double lgammal_r(long double x, int *signgamp)
*/
@@ -26,27 +22,17 @@ static char rcsid[] = "$NetBSD: $";
#include <math_private.h>
-#ifdef __STDC__
- long double __lgammal_r(long double x, int *signgamp)
- /* wrapper lgamma_r */
-#else
- long double __lgammal_r(x,signgamp) /* wrapper lgamma_r */
- long double x; int *signgamp;
-#endif
+long double
+__lgammal_r(long double x, int *signgamp)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgammal_r(x,signgamp);
-#else
- long double y;
- y = __ieee754_lgammal_r(x,signgamp);
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finitel(y)&&__finitel(x)) {
- if(__floorl(x)==x&&x<=0.0)
- return __kernel_standard(x,x,215); /* lgamma pole */
- else
- return __kernel_standard(x,x,214); /* lgamma overflow */
- } else
- return y;
-#endif
+ long double y = __ieee754_lgammal_r(x,signgamp);
+ if(__builtin_expect(!__finitel(y), 0)
+ && __finitel(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, x,
+ __floorl(x)==x&&x<=0.0
+ ? 215 /* lgamma pole */
+ : 214); /* lgamma overflow */
+
+ return y;
}
weak_alias (__lgammal_r, lgammal_r)
diff --git a/math/w_log.c b/math/w_log.c
index 7e9afdf2b8..b43af792c5 100644
--- a/math/w_log.c
+++ b/math/w_log.c
@@ -1,45 +1,46 @@
-/* @(#)w_log.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_log.c,v 1.6 1995/05/10 20:49:33 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper log(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __log(double x) /* wrapper log */
-#else
- double __log(x) /* wrapper log */
- double x;
-#endif
+/* wrapper log(x) */
+double
+__log (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log(x);
-#else
- double z;
- z = __ieee754_log(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x) || x > 0.0) return z;
- if(x==0.0)
- return __kernel_standard(x,x,16); /* log(0) */
- else
- return __kernel_standard(x,x,17); /* log(x<0) */
-#endif
+ if (__builtin_expect (x <= 0.0, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 16); /* log(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 17); /* log(x<0) */
+ }
+ }
+
+ return __ieee754_log (x);
}
weak_alias (__log, log)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_log10.c b/math/w_log10.c
index 08a65add59..75ae580c9b 100644
--- a/math/w_log10.c
+++ b/math/w_log10.c
@@ -1,48 +1,46 @@
-/* @(#)w_log10.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_log10.c,v 1.6 1995/05/10 20:49:35 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper log10(X)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __log10(double x) /* wrapper log10 */
-#else
- double __log10(x) /* wrapper log10 */
- double x;
-#endif
+/* wrapper log10(x) */
+double
+__log10 (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log10(x);
-#else
- double z;
- z = __ieee754_log10(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
- if(x<=0.0) {
- if(x==0.0)
- return __kernel_standard(x,x,18); /* log10(0) */
- else
- return __kernel_standard(x,x,19); /* log10(x<0) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 18); /* log10(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 19); /* log10(x<0) */
+ }
+ }
+
+ return __ieee754_log10 (x);
}
weak_alias (__log10, log10)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_log10f.c b/math/w_log10f.c
index f2ac540f6b..3426e2d05b 100644
--- a/math/w_log10f.c
+++ b/math/w_log10f.c
@@ -1,52 +1,45 @@
-/* w_log10f.c -- float version of w_log10.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_log10f.c,v 1.3 1995/05/10 20:49:37 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper log10f(X)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __log10f(float x) /* wrapper log10f */
-#else
- float __log10f(x) /* wrapper log10f */
- float x;
-#endif
+/* wrapper log10f(x) */
+float
+__log10f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log10f(x);
-#else
- float z;
- z = __ieee754_log10f(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(x<=(float)0.0) {
- if(x==(float)0.0)
- /* log10(0) */
- return (float)__kernel_standard((double)x,(double)x,118);
- else
- /* log10(x<0) */
- return (float)__kernel_standard((double)x,(double)x,119);
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0f, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0f)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard_f (x, x, 118); /* log10(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 119); /* log10(x<0) */
+ }
+ }
+
+ return __ieee754_log10f (x);
}
weak_alias (__log10f, log10f)
diff --git a/math/w_log10l.c b/math/w_log10l.c
index a9a8ed27d8..6f81f3961a 100644
--- a/math/w_log10l.c
+++ b/math/w_log10l.c
@@ -1,51 +1,45 @@
-/* w_log10l.c -- long double version of w_log10.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrapper log10l(X)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __log10l(long double x) /* wrapper log10l */
-#else
- long double __log10l(x) /* wrapper log10l */
- long double x;
-#endif
+/* wrapper log10l(x) */
+long double
+__log10l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log10l(x);
-#else
- long double z;
- z = __ieee754_log10l(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(x<=0.0) {
- if(x==0.0)
- return __kernel_standard(x,x,218); /* log10(0) */
- else
- return __kernel_standard(x,x,219); /* log10(x<0) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0L, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0L)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 218); /* log10(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 219); /* log10(x<0) */
+ }
+ }
+
+ return __ieee754_log10l (x);
}
weak_alias (__log10l, log10l)
diff --git a/math/w_log2.c b/math/w_log2.c
index 90d2dff5d6..6d420438d4 100644
--- a/math/w_log2.c
+++ b/math/w_log2.c
@@ -1,29 +1,46 @@
-/*
- * wrapper log2(X)
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
+
+/* wrapper log2(x) */
double
-__log2 (double x) /* wrapper log2 */
+__log2 (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log2 (x);
-#else
- double z;
- z = __ieee754_log2 (x);
- if (_LIB_VERSION == _IEEE_ || __isnan (x)) return z;
- if (x <= 0.0)
+ if (__builtin_expect (x <= 0.0, 0) && _LIB_VERSION != _IEEE_)
{
if (x == 0.0)
- return __kernel_standard (x, x, 48); /* log2 (0) */
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 48); /* log2(0) */
+ }
else
- return __kernel_standard (x, x, 49); /* log2 (x < 0) */
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 49); /* log2(x<0) */
+ }
}
- else
- return z;
-#endif
+
+ return __ieee754_log2 (x);
}
weak_alias (__log2, log2)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_log2f.c b/math/w_log2f.c
index 10d73ffd1b..7c64ad8b81 100644
--- a/math/w_log2f.c
+++ b/math/w_log2f.c
@@ -1,30 +1,45 @@
-/*
- * wrapper log2(X)
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
+
+/* wrapper log2f(x) */
float
-__log2f (float x) /* wrapper log2f */
+__log2f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log2f (x);
-#else
- float z;
- z = __ieee754_log2f (x);
- if (_LIB_VERSION == _IEEE_ || __isnanf (x)) return z;
- if (x <= 0.0f)
+ if (__builtin_expect (x <= 0.0f, 0) && _LIB_VERSION != _IEEE_)
{
- if (x == 0.0f)
- /* log2f (0) */
- return __kernel_standard ((double) x, (double) x, 148);
+ if (x == 0.0)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard_f (x, x, 148); /* log2(0) */
+ }
else
- /* log2f (x < 0) */
- return __kernel_standard ((double) x, (double) x, 149);
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 149); /* log2(x<0) */
+ }
}
- else
- return z;
-#endif
+
+ return __ieee754_log2f (x);
}
weak_alias (__log2f, log2f)
diff --git a/math/w_log2l.c b/math/w_log2l.c
index ff7ba2621e..f589768b15 100644
--- a/math/w_log2l.c
+++ b/math/w_log2l.c
@@ -1,28 +1,45 @@
-/*
- * wrapper log2l(X)
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
+
+/* wrapper log2l(x) */
long double
-__log2l (long double x) /* wrapper log2l */
+__log2l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log2l (x);
-#else
- long double z;
- z = __ieee754_log2l (x);
- if (_LIB_VERSION == _IEEE_ || __isnanl (x)) return z;
- if (x <= 0.0)
+ if (__builtin_expect (x <= 0.0L, 0) && _LIB_VERSION != _IEEE_)
{
- if (x == 0.0)
- return __kernel_standard (x, x, 248); /* log2l (0) */
+ if (x == 0.0L)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 248); /* log2(0) */
+ }
else
- return __kernel_standard (x, x, 249); /* log2l (x < 0) */
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 249); /* log2(x<0) */
+ }
}
- else
- return z;
-#endif
+
+ return __ieee754_log2l (x);
}
weak_alias (__log2l, log2l)
diff --git a/math/w_logf.c b/math/w_logf.c
index 200a8b7133..52b9befd1b 100644
--- a/math/w_logf.c
+++ b/math/w_logf.c
@@ -1,49 +1,45 @@
-/* w_logf.c -- float version of w_log.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_logf.c,v 1.3 1995/05/10 20:49:40 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper logf(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __logf(float x) /* wrapper logf */
-#else
- float __logf(x) /* wrapper logf */
- float x;
-#endif
+/* wrapper logf(x) */
+float
+__logf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_logf(x);
-#else
- float z;
- z = __ieee754_logf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) || x > (float)0.0) return z;
- if(x==(float)0.0)
- /* logf(0) */
- return (float)__kernel_standard((double)x,(double)x,116);
- else
- /* logf(x<0) */
- return (float)__kernel_standard((double)x,(double)x,117);
-#endif
+ if (__builtin_expect (x <= 0.0f, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0f)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard_f (x, x, 116); /* log(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 117); /* log(x<0) */
+ }
+ }
+
+ return __ieee754_logf (x);
}
weak_alias (__logf, logf)
diff --git a/math/w_logl.c b/math/w_logl.c
index e869bce0f4..9f2bdf06cc 100644
--- a/math/w_logl.c
+++ b/math/w_logl.c
@@ -1,48 +1,45 @@
-/* w_logl.c -- long double version of w_log.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrapper logl(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __logl(long double x) /* wrapper logl */
-#else
- long double __logl(x) /* wrapper logl */
- long double x;
-#endif
+/* wrapper logl(x) */
+long double
+__logl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_logl(x);
-#else
- long double z;
- z = __ieee754_logl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x) || x > 0.0) return z;
- if(x==0.0)
- return __kernel_standard(x,x,216); /* log(0) */
- else
- return __kernel_standard(x,x,217); /* log(x<0) */
-#endif
+ if (__builtin_expect (x <= 0.0L, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0L)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 216); /* log(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 217); /* log(x<0) */
+ }
+ }
+
+ return __ieee754_logl (x);
}
weak_alias (__logl, logl)
diff --git a/math/w_pow.c b/math/w_pow.c
index e0d2a92847..4993c232a6 100644
--- a/math/w_pow.c
+++ b/math/w_pow.c
@@ -1,67 +1,76 @@
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+ 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.
-/* @(#)w_pow.c 5.2 93/10/01 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-/*
- * wrapper pow(x,y) return x**y
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __pow(double x, double y) /* wrapper pow */
-#else
- double __pow(x,y) /* wrapper pow */
- double x,y;
-#endif
+/* wrapper pow */
+double
+__pow (double x, double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_pow(x,y);
-#else
- double z;
- z=__ieee754_pow(x,y);
- if(_LIB_VERSION == _IEEE_|| __isnan(y)) return z;
- if(__isnan(x)) {
- if(y==0.0)
- return __kernel_standard(x,y,42); /* pow(NaN,0.0) */
- else
- return z;
- }
- if(x==0.0) {
- if(y==0.0)
- return __kernel_standard(x,y,20); /* pow(0.0,0.0) */
- if(__finite(y)&&y<0.0) {
- if (signbit (x) && signbit (z))
- return __kernel_standard(x,y,23); /* pow(-0.0,negative) */
+ double z = __ieee754_pow (x, y);
+ if (__builtin_expect (!__finite (z), 0))
+ {
+ if (_LIB_VERSION != _IEEE_)
+ {
+ if (__isnan (x))
+ {
+ if (y == 0.0)
+ /* pow(NaN,0.0) */
+ return __kernel_standard (x, y, 42);
+ }
+ else if (__finite (x) && __finite (y))
+ {
+ if (__isnan (z))
+ /* pow neg**non-int */
+ return __kernel_standard (x, y, 24);
+ else if (x == 0.0 && y < 0.0)
+ {
+ if (signbit (x) && signbit (z))
+ /* pow(-0.0,negative) */
+ return __kernel_standard (x, y, 23);
+ else
+ /* pow(+0.0,negative) */
+ return __kernel_standard (x, y, 43);
+ }
else
- return __kernel_standard(x,y,43); /* pow(+0.0,negative) */
+ /* pow overflow */
+ return __kernel_standard (x, y, 21);
}
- return z;
}
- if(!__finite(z)) {
- if(__finite(x)&&__finite(y)) {
- if(__isnan(z))
- return __kernel_standard(x,y,24); /* pow neg**non-int */
- else
- return __kernel_standard(x,y,21); /* pow overflow */
- }
+ }
+ else if (__builtin_expect (z == 0.0, 0) && __finite (x) && __finite (y)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0)
+ {
+ if (y == 0.0)
+ /* pow(0.0,0.0) */
+ return __kernel_standard (x, y, 20);
}
- if(z==0.0&&__finite(x)&&__finite(y))
- return __kernel_standard(x,y,22); /* pow underflow */
- return z;
-#endif
+ else
+ /* pow underflow */
+ return __kernel_standard (x, y, 22);
+ }
+
+ return z;
}
weak_alias (__pow, pow)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_powf.c b/math/w_powf.c
index 761e4d1328..c0406f4c12 100644
--- a/math/w_powf.c
+++ b/math/w_powf.c
@@ -1,77 +1,75 @@
-/* w_powf.c -- float version of w_pow.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_powf.c,v 1.3 1995/05/10 20:49:41 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper powf(x,y) return x**y
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __powf(float x, float y) /* wrapper powf */
-#else
- float __powf(x,y) /* wrapper powf */
- float x,y;
-#endif
+/* wrapper powf */
+float
+__powf (float x, float y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_powf(x,y);
-#else
- float z;
- z=__ieee754_powf(x,y);
- if(_LIB_VERSION == _IEEE_|| __isnanf(y)) return z;
- if(__isnanf(x)) {
- if(y==(float)0.0)
- /* powf(NaN,0.0) */
- return (float)__kernel_standard((double)x,(double)y,142);
- else
- return z;
- }
- if(x==(float)0.0) {
- if(y==(float)0.0)
- /* powf(0.0,0.0) */
- return (float)__kernel_standard((double)x,(double)y,120);
- if(__finitef(y)&&y<(float)0.0) {
- if (signbit (x) && signbit (z))
- /* powf(0.0,negative) */
- return (float)__kernel_standard((double)x,(double)y,123);
+ float z = __ieee754_powf (x, y);
+ if (__builtin_expect (!__finitef (z), 0))
+ {
+ if (_LIB_VERSION != _IEEE_)
+ {
+ if (__isnanf (x))
+ {
+ if (y == 0.0f)
+ /* pow(NaN,0.0) */
+ return __kernel_standard_f (x, y, 142);
+ }
+ else if (__finitef (x) && __finitef (y))
+ {
+ if (__isnanf (z))
+ /* pow neg**non-int */
+ return __kernel_standard_f (x, y, 124);
+ else if (x == 0.0f && y < 0.0f)
+ {
+ if (signbit (x) && signbit (z))
+ /* pow(-0.0,negative) */
+ return __kernel_standard_f (x, y, 123);
+ else
+ /* pow(+0.0,negative) */
+ return __kernel_standard_f (x, y, 143);
+ }
else
- return (float)__kernel_standard((double)x,(double)y,143);
+ /* pow overflow */
+ return __kernel_standard_f (x, y, 121);
}
- return z;
}
- if(!__finitef(z)) {
- if(__finitef(x)&&__finitef(y)) {
- if(__isnanf(z))
- /* powf neg**non-int */
- return (float)__kernel_standard((double)x,(double)y,124);
- else
- /* powf overflow */
- return (float)__kernel_standard((double)x,(double)y,121);
- }
+ }
+ else if (__builtin_expect (z == 0.0f, 0) && __finitef (x) && __finitef (y)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0f)
+ {
+ if (y == 0.0f)
+ /* pow(0.0,0.0) */
+ return __kernel_standard_f (x, y, 120);
}
- if(z==(float)0.0&&__finitef(x)&&__finitef(y))
- /* powf underflow */
- return (float)__kernel_standard((double)x,(double)y,122);
- return z;
-#endif
+ else
+ /* pow underflow */
+ return __kernel_standard_f (x, y, 122);
+ }
+
+ return z;
}
weak_alias (__powf, powf)
diff --git a/math/w_powl.c b/math/w_powl.c
index 0bb09518d5..1ad581ad94 100644
--- a/math/w_powl.c
+++ b/math/w_powl.c
@@ -1,68 +1,75 @@
-/* w_powl.c -- long double version of w_pow.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-/*
- * wrapper powl(x,y) return x**y
- */
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __powl(long double x, long double y)/* wrapper powl */
-#else
- long double __powl(x,y) /* wrapper powl */
- long double x,y;
-#endif
+/* wrapper powl */
+long double
+__powl (long double x, long double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_powl(x,y);
-#else
- long double z;
- z=__ieee754_powl(x,y);
- if(_LIB_VERSION == _IEEE_|| __isnanl(y)) return z;
- if(__isnanl(x)) {
- if(y==0.0)
- return __kernel_standard(x,y,242); /* pow(NaN,0.0) */
- else
- return z;
- }
- if(x==0.0) {
- if(y==0.0)
- return __kernel_standard(x,y,220); /* pow(0.0,0.0) */
- if(__finitel(y)&&y<0.0) {
- if (signbit (x) && signbit (z))
- return __kernel_standard(x,y,223); /* pow(-0.0,negative) */
+ long double z = __ieee754_powl (x, y);
+ if (__builtin_expect (!__finitel (z), 0))
+ {
+ if (_LIB_VERSION != _IEEE_)
+ {
+ if (__isnanl (x))
+ {
+ if (y == 0.0L)
+ /* pow(NaN,0.0) */
+ return __kernel_standard (x, y, 242);
+ }
+ else if (__finitel (x) && __finitel (y))
+ {
+ if (__isnanl (z))
+ /* pow neg**non-int */
+ return __kernel_standard (x, y, 224);
+ else if (x == 0.0L && y < 0.0L)
+ {
+ if (signbit (x) && signbit (z))
+ /* pow(-0.0,negative) */
+ return __kernel_standard (x, y, 223);
+ else
+ /* pow(+0.0,negative) */
+ return __kernel_standard (x, y, 243);
+ }
else
- return __kernel_standard(x,y,243); /* pow(+0.0,negative) */
+ /* pow overflow */
+ return __kernel_standard (x, y, 221);
}
- return z;
}
- if(!__finitel(z)) {
- if(__finitel(x)&&__finitel(y)) {
- if(__isnanl(z))
- return __kernel_standard(x,y,224); /* pow neg**non-int */
- else
- return __kernel_standard(x,y,221); /* pow overflow */
- }
+ }
+ else if (__builtin_expect (z == 0.0L, 0) && __finitel (x) && __finitel (y)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0L)
+ {
+ if (y == 0.0L)
+ /* pow(0.0,0.0) */
+ return __kernel_standard (x, y, 220);
}
- if(z==0.0&&__finitel(x)&&__finitel(y))
- return __kernel_standard(x,y,222); /* pow underflow */
- return z;
-#endif
+ else
+ /* pow underflow */
+ return __kernel_standard (x, y, 222);
+ }
+
+ return z;
}
weak_alias (__powl, powl)
diff --git a/math/w_remainder.c b/math/w_remainder.c
index cf35ee24bd..524cbf582a 100644
--- a/math/w_remainder.c
+++ b/math/w_remainder.c
@@ -1,44 +1,36 @@
-/* @(#)w_remainder.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_remainder.c,v 1.6 1995/05/10 20:49:44 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper remainder(x,p)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __remainder(double x, double y) /* wrapper remainder */
-#else
- double __remainder(x,y) /* wrapper remainder */
- double x,y;
-#endif
+
+/* wrapper remainder */
+double
+__remainder (double x, double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_remainder(x,y);
-#else
- double z;
- z = __ieee754_remainder(x,y);
- if(_LIB_VERSION == _IEEE_ || __isnan(y) || __isnan(x)) return z;
- if(y==0.0 || __isinf_ns(x))
- return __kernel_standard(x,y,28); /* remainder(x,0) */
- else
- return z;
-#endif
+ if (((__builtin_expect (y == 0.0, 0) && ! __isnan (x))
+ || (__builtin_expect (__isinf_ns (x), 0) && ! __isnan (y)))
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, y, 28); /* remainder domain */
+
+ return __ieee754_remainder (x, y);
}
weak_alias (__remainder, remainder)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_remainderf.c b/math/w_remainderf.c
index 39d01b3fa0..9bddf6f619 100644
--- a/math/w_remainderf.c
+++ b/math/w_remainderf.c
@@ -1,47 +1,35 @@
-/* w_remainderf.c -- float version of w_remainder.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_remainderf.c,v 1.3 1995/05/10 20:49:46 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper remainderf(x,p)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __remainderf(float x, float y) /* wrapper remainder */
-#else
- float __remainderf(x,y) /* wrapper remainder */
- float x,y;
-#endif
+
+/* wrapper remainderf */
+float
+__remainderf (float x, float y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_remainderf(x,y);
-#else
- float z;
- z = __ieee754_remainderf(x,y);
- if(_LIB_VERSION == _IEEE_ || __isnanf(y) || __isnanf(x)) return z;
- if(y==(float)0.0 || __isinf_nsf(x))
- /* remainder(x,0) */
- return (float)__kernel_standard((double)x,(double)y,128);
- else
- return z;
-#endif
+ if (((__builtin_expect (y == 0.0f, 0) && ! __isnanf (x))
+ || (__builtin_expect (__isinf_nsf (x), 0) && ! __isnanf (y)))
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, y, 128); /* remainder domain */
+
+ return __ieee754_remainderf (x, y);
}
weak_alias (__remainderf, remainderf)
diff --git a/math/w_remainderl.c b/math/w_remainderl.c
index dec70e5028..66a141328b 100644
--- a/math/w_remainderl.c
+++ b/math/w_remainderl.c
@@ -1,48 +1,35 @@
-/* w_remainderl.c -- long double version of w_remainder.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrapper remainderl(x,p)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __remainderl(long double x, long double y)
- /* wrapper remainderl */
-#else
- long double __remainderl(x,y) /* wrapper remainder */
- long double x,y;
-#endif
+
+/* wrapper remainderl */
+long double
+__remainderl (long double x, long double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_remainderl(x,y);
-#else
- long double z;
- z = __ieee754_remainderl(x,y);
- if(_LIB_VERSION == _IEEE_ || __isnanl(y) || __isnanl(x)) return z;
- if(y==0.0 || __isinf_nsl(x))
- return __kernel_standard(x,y,228); /* remainder(x,0) */
- else
- return z;
-#endif
+ if (((__builtin_expect (y == 0.0L, 0) && ! __isnanl (x))
+ || (__builtin_expect (__isinf_nsl (x), 0) && ! __isnanl (y)))
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, y, 228); /* remainder domain */
+
+ return __ieee754_remainderl (x, y);
}
weak_alias (__remainderl, remainderl)
diff --git a/math/w_scalb.c b/math/w_scalb.c
index 830f387644..91f3658a67 100644
--- a/math/w_scalb.c
+++ b/math/w_scalb.c
@@ -1,62 +1,54 @@
-/* @(#)w_scalb.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_scalb.c,v 1.6 1995/05/10 20:49:48 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper scalb(double x, double fn) is provide for
- * passing various standard test suite. One
- * should use scalbn() instead.
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <errno.h>
#include <math.h>
#include <math_private.h>
-#include <errno.h>
-#ifdef __STDC__
-#ifdef _SCALB_INT
- double __scalb(double x, int fn) /* wrapper scalb */
-#else
- double __scalb(double x, double fn) /* wrapper scalb */
-#endif
-#else
- double __scalb(x,fn) /* wrapper scalb */
-#ifdef _SCALB_INT
- double x; int fn;
-#else
- double x,fn;
-#endif
-#endif
+static double
+__attribute__ ((noinline))
+sysv_scalb (double x, double fn)
{
-#ifdef _IEEE_LIBM
- return __ieee754_scalb(x,fn);
-#else
- double z;
- z = __ieee754_scalb(x,fn);
- if(_LIB_VERSION != _SVID_) return z;
- if(!(__finite(z)||__isnan(z))&&__finite(x)) {
- return __kernel_standard(x,(double)fn,32); /* scalb overflow */
- }
- if(z==0.0&&z!=x) {
- return __kernel_standard(x,(double)fn,33); /* scalb underflow */
- }
-#ifndef _SCALB_INT
- if(!__finite(fn)) __set_errno (ERANGE);
-#endif
- return z;
-#endif
+ double z = __ieee754_scalb (x, fn);
+
+ if (__builtin_expect (__isinf (z), 0))
+ {
+ if (__finite (x))
+ return __kernel_standard (x, fn, 32); /* scalb overflow */
+ else
+ __set_errno (ERANGE);
+ }
+ else if (__builtin_expect (z == 0.0, 0) && z != x)
+ return __kernel_standard (x, fn, 33); /* scalb underflow */
+
+ return z;
+}
+
+
+/* Wrapper scalb */
+double
+__scalb (double x, double fn)
+{
+ return (__builtin_expect (_LIB_VERSION == _SVID_, 0)
+ ? sysv_scalb (x, fn)
+ : __ieee754_scalb (x, fn));
}
weak_alias (__scalb, scalb)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_scalbf.c b/math/w_scalbf.c
index bd92cc1c00..b8ee3f1b46 100644
--- a/math/w_scalbf.c
+++ b/math/w_scalbf.c
@@ -1,66 +1,53 @@
-/* w_scalbf.c -- float version of w_scalb.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_scalbf.c,v 1.3 1995/05/10 20:49:50 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper scalbf(float x, float fn) is provide for
- * passing various standard test suite. One
- * should use scalbn() instead.
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <errno.h>
#include <math.h>
#include <math_private.h>
-#include <errno.h>
-#ifdef __STDC__
-#ifdef _SCALB_INT
- float __scalbf(float x, int fn) /* wrapper scalbf */
-#else
- float __scalbf(float x, float fn) /* wrapper scalbf */
-#endif
-#else
- float __scalbf(x,fn) /* wrapper scalbf */
-#ifdef _SCALB_INT
- float x; int fn;
-#else
- float x,fn;
-#endif
-#endif
+static float
+__attribute__ ((noinline))
+sysv_scalbf (float x, float fn)
+{
+ float z = __ieee754_scalbf (x, fn);
+
+ if (__builtin_expect (__isinff (z), 0))
+ {
+ if (__finitef (x))
+ return __kernel_standard_f (x, fn, 132); /* scalb overflow */
+ else
+ __set_errno (ERANGE);
+ }
+ else if (__builtin_expect (z == 0.0f, 0) && z != x)
+ return __kernel_standard_f (x, fn, 133); /* scalb underflow */
+
+ return z;
+}
+
+
+/* Wrapper scalbf */
+float
+__scalbf (float x, float fn)
{
-#ifdef _IEEE_LIBM
- return __ieee754_scalbf(x,fn);
-#else
- float z;
- z = __ieee754_scalbf(x,fn);
- if(_LIB_VERSION != _SVID_) return z;
- if(!(__finitef(z)||__isnanf(z))&&__finitef(x)) {
- /* scalbf overflow */
- return (float)__kernel_standard((double)x,(double)fn,132);
- }
- if(z==(float)0.0&&z!=x) {
- /* scalbf underflow */
- return (float)__kernel_standard((double)x,(double)fn,133);
- }
-#ifndef _SCALB_INT
- if(!__finitef(fn)) __set_errno (ERANGE);
-#endif
- return z;
-#endif
+ return (__builtin_expect (_LIB_VERSION == _SVID_, 0)
+ ? sysv_scalbf (x, fn)
+ : __ieee754_scalbf (x, fn));
}
weak_alias (__scalbf, scalbf)
diff --git a/math/w_scalbl.c b/math/w_scalbl.c
index eb118b19b7..33fc725e5f 100644
--- a/math/w_scalbl.c
+++ b/math/w_scalbl.c
@@ -1,65 +1,53 @@
-/* w_scalbl.c -- long double version of w_scalb.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrapper scalbl(long double x, long double fn) is provide for
- * passing various standard test suite. One
- * should use scalbnl() instead.
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <errno.h>
#include <math.h>
#include <math_private.h>
-#include <errno.h>
-#ifdef __STDC__
-#ifdef _SCALB_INT
- long double __scalbl(long double x, int fn) /* wrapper scalbl */
-#else
- long double __scalbl(long double x, long double fn)/* wrapper scalbl */
-#endif
-#else
- long double __scalbl(x,fn) /* wrapper scalbl */
-#ifdef _SCALB_INT
- long double x; int fn;
-#else
- long double x,fn;
-#endif
-#endif
+static long double
+__attribute__ ((noinline))
+sysv_scalbl (long double x, long double fn)
+{
+ long double z = __ieee754_scalbl (x, fn);
+
+ if (__builtin_expect (__isinfl (z), 0))
+ {
+ if (__finitel (x))
+ return __kernel_standard (x, fn, 232); /* scalb overflow */
+ else
+ __set_errno (ERANGE);
+ }
+ else if (__builtin_expect (z == 0.0L, 0) && z != x)
+ return __kernel_standard (x, fn, 233); /* scalb underflow */
+
+ return z;
+}
+
+
+/* Wrapper scalbl */
+long double
+__scalbl (long double x, long double fn)
{
-#ifdef _IEEE_LIBM
- return __ieee754_scalbl(x,fn);
-#else
- long double z;
- z = __ieee754_scalbl(x,fn);
- if(_LIB_VERSION != _SVID_) return z;
- if(!(__finitel(z)||__isnanl(z))&&__finitel(x)) {
- return __kernel_standard(x,(double)fn,232); /* scalb overflow */
- }
- if(z==0.0&&z!=x) {
- return __kernel_standard(x,(double)fn,233); /* scalb underflow */
- }
-#ifndef _SCALB_INT
- if(!__finitel(fn)) __set_errno (ERANGE);
-#endif
- return z;
-#endif
+ return (__builtin_expect (_LIB_VERSION == _SVID_, 0)
+ ? sysv_scalbl (x, fn)
+ : __ieee754_scalbl (x, fn));
}
weak_alias (__scalbl, scalbl)
diff --git a/math/w_sinh.c b/math/w_sinh.c
index c95e154fc3..34ad2d8624 100644
--- a/math/w_sinh.c
+++ b/math/w_sinh.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sinh.c,v 1.6 1995/05/10 20:49:51 jtc Exp $";
-#endif
-
/*
* wrapper sinh(x)
*/
@@ -21,24 +17,15 @@ static char rcsid[] = "$NetBSD: w_sinh.c,v 1.6 1995/05/10 20:49:51 jtc Exp $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __sinh(double x) /* wrapper sinh */
-#else
- double __sinh(x) /* wrapper sinh */
- double x;
-#endif
+double
+__sinh (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sinh(x);
-#else
- double z;
- z = __ieee754_sinh(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finite(z)&&__finite(x)) {
- return __kernel_standard(x,x,25); /* sinh overflow */
- } else
- return z;
-#endif
+ double z = __ieee754_sinh (x);
+ if (__builtin_expect (!__finite (z), 0) && __finite (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 25); /* sinh overflow */
+
+ return z;
}
weak_alias (__sinh, sinh)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_sinhf.c b/math/w_sinhf.c
index c3555999ed..1347e91728 100644
--- a/math/w_sinhf.c
+++ b/math/w_sinhf.c
@@ -8,40 +8,26 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sinhf.c,v 1.3 1995/05/10 20:49:54 jtc Exp $";
-#endif
-
-/*
+/*
* wrapper sinhf(x)
*/
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __sinhf(float x) /* wrapper sinhf */
-#else
- float __sinhf(x) /* wrapper sinhf */
- float x;
-#endif
+float
+__sinhf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sinhf(x);
-#else
- float z;
- z = __ieee754_sinhf(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finitef(z)&&__finitef(x)) {
- /* sinhf overflow */
- return (float)__kernel_standard((double)x,(double)x,125);
- } else
- return z;
-#endif
+ float z = __ieee754_sinhf (x);
+ if (__builtin_expect (!__finitef (z), 0) && __finitef (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, x, 125); /* sinhf overflow */
+
+ return z;
}
weak_alias (__sinhf, sinhf)
diff --git a/math/w_sinhl.c b/math/w_sinhl.c
index da7de8185b..5e65cf9b95 100644
--- a/math/w_sinhl.c
+++ b/math/w_sinhl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/*
* wrapper sinhl(x)
*/
@@ -25,23 +21,14 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __sinhl(long double x) /* wrapper sinhl */
-#else
- long double __sinhl(x) /* wrapper sinhl */
- long double x;
-#endif
+long double
+__sinhl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sinhl(x);
-#else
- long double z;
- z = __ieee754_sinhl(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finitel(z)&&__finitel(x)) {
- return __kernel_standard(x,x,225); /* sinh overflow */
- } else
- return z;
-#endif
+ long double z = __ieee754_sinhl (x);
+ if (__builtin_expect (!__finitel (z), 0) && __finitel (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 225); /* sinh overflow */
+
+ return z;
}
weak_alias (__sinhl, sinhl)
diff --git a/math/w_sqrt.c b/math/w_sqrt.c
index c281bf40af..8a435ef48e 100644
--- a/math/w_sqrt.c
+++ b/math/w_sqrt.c
@@ -1,44 +1,34 @@
-/* @(#)w_sqrt.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sqrt.c,v 1.6 1995/05/10 20:49:55 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper sqrt(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __sqrt(double x) /* wrapper sqrt */
-#else
- double __sqrt(x) /* wrapper sqrt */
- double x;
-#endif
+
+/* wrapper sqrt */
+double
+__sqrt (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sqrt(x);
-#else
- double z;
- z = __ieee754_sqrt(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
- if(x<0.0) {
- return __kernel_standard(x,x,26); /* sqrt(negative) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x < 0.0, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 26); /* sqrt(negative) */
+
+ return __ieee754_sqrt (x);
}
weak_alias (__sqrt, sqrt)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_sqrtf.c b/math/w_sqrtf.c
index 854d1cded2..fc088b6222 100644
--- a/math/w_sqrtf.c
+++ b/math/w_sqrtf.c
@@ -1,47 +1,33 @@
-/* w_sqrtf.c -- float version of w_sqrt.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sqrtf.c,v 1.3 1995/05/10 20:49:59 jtc Exp $";
-#endif
+ 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.
-/*
- * wrapper sqrtf(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __sqrtf(float x) /* wrapper sqrtf */
-#else
- float sqrt(x) /* wrapper sqrtf */
- float x;
-#endif
+
+/* wrapper sqrtf */
+float
+__sqrtf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sqrtf(x);
-#else
- float z;
- z = __ieee754_sqrtf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(x<(float)0.0) {
- /* sqrtf(negative) */
- return (float)__kernel_standard((double)x,(double)x,126);
- } else
- return z;
-#endif
+ if (__builtin_expect (x < 0.0f, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, x, 126); /* sqrt(negative) */
+
+ return __ieee754_sqrtf (x);
}
weak_alias (__sqrtf, sqrtf)
diff --git a/math/w_sqrtl.c b/math/w_sqrtl.c
index 43770eeb39..0c446295c6 100644
--- a/math/w_sqrtl.c
+++ b/math/w_sqrtl.c
@@ -1,47 +1,33 @@
-/* w_sqrtl.c -- long double version of w_sqrt.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+ 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.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ 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.
-/*
- * wrapper sqrtl(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __sqrtl(long double x) /* wrapper sqrtl */
-#else
- long double __sqrtl(x) /* wrapper sqrtl */
- long double x;
-#endif
+
+/* wrapper sqrtl */
+long double
+__sqrtl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sqrtl(x);
-#else
- long double z;
- z = __ieee754_sqrtl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(x<0.0) {
- return __kernel_standard(x,x,226); /* sqrt(negative) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x < 0.0L, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 226); /* sqrt(negative) */
+
+ return __ieee754_sqrtl (x);
}
weak_alias (__sqrtl, sqrtl)
diff --git a/math/w_tgamma.c b/math/w_tgamma.c
index 14d6855829..976b5fb95c 100644
--- a/math/w_tgamma.c
+++ b/math/w_tgamma.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
-#endif
-
/* double gamma(double x)
* Return the logarithm of the Gamma function of x or the Gamma function of x,
* depending on the library mode.
@@ -22,23 +18,14 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __tgamma(double x)
-#else
- double __tgamma(x)
- double x;
-#endif
+double
+__tgamma(double x)
{
- double y;
int local_signgam;
- y = __ieee754_gamma_r(x,&local_signgam);
- if (local_signgam < 0) y = -y;
-#ifdef _IEEE_LIBM
- return y;
-#else
- if(_LIB_VERSION == _IEEE_) return y;
+ double y = __ieee754_gamma_r(x,&local_signgam);
- if(!__finite(y)&&__finite(x)) {
+ if(__builtin_expect(!__finite(y), 0)&&__finite(x)
+ && _LIB_VERSION != _IEEE_) {
if (x == 0.0)
return __kernel_standard(x,x,50); /* tgamma pole */
else if(__floor(x)==x&&x<0.0)
@@ -46,8 +33,7 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
else
return __kernel_standard(x,x,40); /* tgamma overflow */
}
- return y;
-#endif
+ return local_signgam < 0 ? -y : y;
}
weak_alias (__tgamma, tgamma)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_tgammaf.c b/math/w_tgammaf.c
index b1e72c653d..48141354e2 100644
--- a/math/w_tgammaf.c
+++ b/math/w_tgammaf.c
@@ -13,41 +13,27 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $";
-#endif
-
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __tgammaf(float x)
-#else
- float __tgammaf(x)
- float x;
-#endif
+float
+__tgammaf(float x)
{
- float y;
int local_signgam;
- y = __ieee754_gammaf_r(x,&local_signgam);
- if (local_signgam < 0) y = -y;
-#ifdef _IEEE_LIBM
- return y;
-#else
- if(_LIB_VERSION == _IEEE_) return y;
+ float y = __ieee754_gammaf_r(x,&local_signgam);
- if(!__finitef(y)&&__finitef(x)) {
+ if(__builtin_expect(!__finitef(y), 0) && __finitef(x)
+ && _LIB_VERSION != _IEEE_) {
if (x == (float)0.0)
/* tgammaf pole */
- return (float)__kernel_standard((double)x,(double)x,150);
- else if(__floorf(x)==x&&x<(float)0.0)
+ return __kernel_standard_f(x, x, 150);
+ else if(__floorf(x)==x&&x<0.0f)
/* tgammaf domain */
- return (float)__kernel_standard((double)x,(double)x,141);
+ return __kernel_standard_f(x, x, 141);
else
/* tgammaf overflow */
- return (float)__kernel_standard((double)x,(double)x,140);
+ return __kernel_standard_f(x, x, 140);
}
- return y;
-#endif
+ return local_signgam < 0 ? - y : y;
}
weak_alias (__tgammaf, tgammaf)
diff --git a/math/w_tgammal.c b/math/w_tgammal.c
index 63379a8575..6910f923aa 100644
--- a/math/w_tgammal.c
+++ b/math/w_tgammal.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* long double gammal(double x)
* Return the Gamma function of x.
*/
@@ -25,31 +21,21 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __tgammal(long double x)
-#else
- long double __tgammal(x)
- long double x;
-#endif
+long double
+__tgammal(long double x)
{
- long double y;
int local_signgam;
- y = __ieee754_gammal_r(x,&local_signgam);
- if (local_signgam < 0) y = -y;
-#ifdef _IEEE_LIBM
- return y;
-#else
- if(_LIB_VERSION == _IEEE_) return y;
+ long double y = __ieee754_gammal_r(x,&local_signgam);
- if(!__finitel(y)&&__finitel(x)) {
+ if(__builtin_expect(!__finitel(y), 0) && __finitel(x)
+ && _LIB_VERSION != _IEEE_) {
if(x==0.0)
return __kernel_standard(x,x,250); /* tgamma pole */
- else if(__floorl(x)==x&&x<0.0)
+ else if(__floorl(x)==x&&x<0.0L)
return __kernel_standard(x,x,241); /* tgamma domain */
else
return __kernel_standard(x,x,240); /* tgamma overflow */
}
- return y;
-#endif
+ return local_signgam < 0 ? - y : y;
}
weak_alias (__tgammal, tgammal)