summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /math
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
2.5-18.1
Diffstat (limited to 'math')
-rw-r--r--math/Makefile16
-rw-r--r--math/Versions9
-rw-r--r--math/basic-test.c36
-rw-r--r--math/bits/mathcalls.h13
-rw-r--r--math/bug-nextafter.c255
-rw-r--r--math/bug-nexttoward.c255
-rw-r--r--math/cabsf.c29
-rw-r--r--math/cargf.c29
-rw-r--r--math/cimagf.c28
-rw-r--r--math/complex.h11
-rw-r--r--math/conjf.c28
-rw-r--r--math/crealf.c28
-rw-r--r--math/divtc3.c75
-rw-r--r--math/e_acoshl.c14
-rw-r--r--math/e_acosl.c14
-rw-r--r--math/e_asinl.c14
-rw-r--r--math/e_atan2l.c14
-rw-r--r--math/e_atanhl.c14
-rw-r--r--math/e_coshl.c14
-rw-r--r--math/e_exp10.c30
-rw-r--r--math/e_exp10f.c30
-rw-r--r--math/e_exp10l.c30
-rw-r--r--math/e_exp2l.c10
-rw-r--r--math/e_expl.c14
-rw-r--r--math/e_fmodl.c14
-rw-r--r--math/e_gammal_r.c15
-rw-r--r--math/e_hypotl.c14
-rw-r--r--math/e_j0l.c25
-rw-r--r--math/e_j1l.c25
-rw-r--r--math/e_jnl.c25
-rw-r--r--math/e_lgammal_r.c17
-rw-r--r--math/e_log10l.c14
-rw-r--r--math/e_log2l.c14
-rw-r--r--math/e_logl.c14
-rw-r--r--math/e_powl.c14
-rw-r--r--math/e_rem_pio2l.c15
-rw-r--r--math/e_scalb.c71
-rw-r--r--math/e_scalbf.c68
-rw-r--r--math/e_scalbl.c75
-rw-r--r--math/e_sinhl.c14
-rw-r--r--math/e_sqrtl.c14
-rw-r--r--math/fclrexcpt.c37
-rw-r--r--math/fedisblxcpt.c30
-rw-r--r--math/feenablxcpt.c30
-rw-r--r--math/fegetenv.c38
-rw-r--r--math/fegetexcept.c30
-rw-r--r--math/fegetround.c29
-rw-r--r--math/feholdexcpt.c30
-rw-r--r--math/fesetenv.c38
-rw-r--r--math/fesetround.c30
-rw-r--r--math/feupdateenv.c37
-rw-r--r--math/fgetexcptflg.c37
-rw-r--r--math/fpu_control.c25
-rw-r--r--math/fraiseexcpt.c38
-rw-r--r--math/fsetexcptflg.c37
-rw-r--r--math/ftestexcept.c29
-rwxr-xr-xmath/gen-libm-test.pl19
-rw-r--r--math/k_cosl.c15
-rw-r--r--math/k_rem_pio2l.c16
-rw-r--r--math/k_sincosl.c1
-rw-r--r--math/k_sinl.c15
-rw-r--r--math/k_tanl.c15
-rw-r--r--math/libm-test.inc1571
-rw-r--r--math/math.h31
-rw-r--r--math/math_private.h21
-rw-r--r--math/multc3.c80
-rw-r--r--math/s_asinhl.c15
-rw-r--r--math/s_atanl.c15
-rw-r--r--math/s_cacos.c41
-rw-r--r--math/s_cacosf.c39
-rw-r--r--math/s_cacosh.c95
-rw-r--r--math/s_cacoshf.c108
-rw-r--r--math/s_cacoshl.c91
-rw-r--r--math/s_cacosl.c37
-rw-r--r--math/s_casin.c66
-rw-r--r--math/s_casinf.c64
-rw-r--r--math/s_casinh.c84
-rw-r--r--math/s_casinhf.c82
-rw-r--r--math/s_casinhl.c80
-rw-r--r--math/s_casinl.c62
-rw-r--r--math/s_catan.c89
-rw-r--r--math/s_catanf.c87
-rw-r--r--math/s_catanh.c84
-rw-r--r--math/s_catanhf.c82
-rw-r--r--math/s_catanhl.c80
-rw-r--r--math/s_catanl.c85
-rw-r--r--math/s_cbrtl.c15
-rw-r--r--math/s_ccos.c80
-rw-r--r--math/s_ccosf.c78
-rw-r--r--math/s_ccosh.c105
-rw-r--r--math/s_ccoshf.c103
-rw-r--r--math/s_ccoshl.c101
-rw-r--r--math/s_ccosl.c76
-rw-r--r--math/s_cexp.c127
-rw-r--r--math/s_cexpf.c125
-rw-r--r--math/s_cexpl.c123
-rw-r--r--math/s_clog.c65
-rw-r--r--math/s_clog10.c65
-rw-r--r--math/s_clog10f.c63
-rw-r--r--math/s_clog10l.c61
-rw-r--r--math/s_clogf.c63
-rw-r--r--math/s_clogl.c61
-rw-r--r--math/s_cpow.c34
-rw-r--r--math/s_cpowf.c32
-rw-r--r--math/s_cpowl.c30
-rw-r--r--math/s_cproj.c51
-rw-r--r--math/s_cprojf.c49
-rw-r--r--math/s_cprojl.c48
-rw-r--r--math/s_csin.c131
-rw-r--r--math/s_csinf.c129
-rw-r--r--math/s_csinh.c126
-rw-r--r--math/s_csinhf.c124
-rw-r--r--math/s_csinhl.c122
-rw-r--r--math/s_csinl.c127
-rw-r--r--math/s_csqrt.c114
-rw-r--r--math/s_csqrtf.c112
-rw-r--r--math/s_csqrtl.c110
-rw-r--r--math/s_ctan.c84
-rw-r--r--math/s_ctanf.c83
-rw-r--r--math/s_ctanh.c84
-rw-r--r--math/s_ctanhf.c82
-rw-r--r--math/s_ctanhl.c80
-rw-r--r--math/s_ctanl.c81
-rw-r--r--math/s_erfl.c26
-rw-r--r--math/s_expm1l.c16
-rw-r--r--math/s_fdim.c40
-rw-r--r--math/s_fdimf.c36
-rw-r--r--math/s_fdiml.c36
-rw-r--r--math/s_fma.c33
-rw-r--r--math/s_fmaf.c28
-rw-r--r--math/s_fmal.c28
-rw-r--r--math/s_fmax.c33
-rw-r--r--math/s_fmaxf.c29
-rw-r--r--math/s_fmaxl.c29
-rw-r--r--math/s_fmin.c33
-rw-r--r--math/s_fminf.c29
-rw-r--r--math/s_fminl.c29
-rw-r--r--math/s_ldexp.c37
-rw-r--r--math/s_ldexpf.c37
-rw-r--r--math/s_ldexpl.c37
-rw-r--r--math/s_log1pl.c15
-rw-r--r--math/s_nan.c44
-rw-r--r--math/s_nanf.c40
-rw-r--r--math/s_nanl.c40
-rw-r--r--math/s_nextafter.c100
-rw-r--r--math/s_nexttowardf.c85
-rw-r--r--math/s_nexttowardl.c1
-rw-r--r--math/s_significand.c39
-rw-r--r--math/s_significandf.c32
-rw-r--r--math/s_significandl.c39
-rw-r--r--math/s_tanhl.c15
-rw-r--r--math/setfpucw.c37
-rw-r--r--math/t_sincosl.c1
-rw-r--r--math/test-misc.c114
-rw-r--r--math/test-tgmath-int.c71
-rw-r--r--math/tgmath.h15
-rw-r--r--math/w_acos.c48
-rw-r--r--math/w_acosf.c48
-rw-r--r--math/w_acosh.c47
-rw-r--r--math/w_acoshf.c48
-rw-r--r--math/w_acoshl.c47
-rw-r--r--math/w_acosl.c48
-rw-r--r--math/w_asin.c49
-rw-r--r--math/w_asinf.c49
-rw-r--r--math/w_asinl.c49
-rw-r--r--math/w_atan2.c47
-rw-r--r--math/w_atan2f.c46
-rw-r--r--math/w_atan2l.c47
-rw-r--r--math/w_atanh.c52
-rw-r--r--math/w_atanhf.c53
-rw-r--r--math/w_atanhl.c52
-rw-r--r--math/w_cosh.c47
-rw-r--r--math/w_coshf.c47
-rw-r--r--math/w_coshl.c47
-rw-r--r--math/w_drem.c20
-rw-r--r--math/w_dremf.c17
-rw-r--r--math/w_dreml.c18
-rw-r--r--math/w_exp10.c51
-rw-r--r--math/w_exp10f.c46
-rw-r--r--math/w_exp10l.c46
-rw-r--r--math/w_exp2.c36
-rw-r--r--math/w_exp2f.c32
-rw-r--r--math/w_exp2l.c31
-rw-r--r--math/w_expl.c13
-rw-r--r--math/w_fmod.c48
-rw-r--r--math/w_fmodf.c48
-rw-r--r--math/w_fmodl.c48
-rw-r--r--math/w_hypot.c48
-rw-r--r--math/w_hypotf.c48
-rw-r--r--math/w_hypotl.c48
-rw-r--r--math/w_j0.c76
-rw-r--r--math/w_j0f.c74
-rw-r--r--math/w_j0l.c76
-rw-r--r--math/w_j1.c77
-rw-r--r--math/w_j1f.c75
-rw-r--r--math/w_j1l.c76
-rw-r--r--math/w_jn.c99
-rw-r--r--math/w_jnf.c71
-rw-r--r--math/w_jnl.c98
-rw-r--r--math/w_lgamma.c60
-rw-r--r--math/w_lgamma_r.c51
-rw-r--r--math/w_lgammaf.c53
-rw-r--r--math/w_lgammaf_r.c52
-rw-r--r--math/w_lgammal.c58
-rw-r--r--math/w_lgammal_r.c52
-rw-r--r--math/w_log.c48
-rw-r--r--math/w_log10.c51
-rw-r--r--math/w_log10f.c52
-rw-r--r--math/w_log10l.c51
-rw-r--r--math/w_log2.c32
-rw-r--r--math/w_log2f.c30
-rw-r--r--math/w_log2l.c28
-rw-r--r--math/w_logf.c49
-rw-r--r--math/w_logl.c48
-rw-r--r--math/w_pow.c70
-rw-r--r--math/w_powf.c77
-rw-r--r--math/w_powl.c68
-rw-r--r--math/w_remainder.c47
-rw-r--r--math/w_remainderf.c47
-rw-r--r--math/w_remainderl.c48
-rw-r--r--math/w_scalb.c65
-rw-r--r--math/w_scalbf.c66
-rw-r--r--math/w_scalbl.c65
-rw-r--r--math/w_sinh.c47
-rw-r--r--math/w_sinhf.c47
-rw-r--r--math/w_sinhl.c47
-rw-r--r--math/w_sqrt.c47
-rw-r--r--math/w_sqrtf.c47
-rw-r--r--math/w_sqrtl.c47
-rw-r--r--math/w_tgamma.c56
-rw-r--r--math/w_tgammaf.c53
-rw-r--r--math/w_tgammal.c55
232 files changed, 13351 insertions, 45 deletions
diff --git a/math/Makefile b/math/Makefile
index c4501b87f4..1ab1b13b07 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -1,4 +1,5 @@
-# Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1996-2001,2002,2003,2004,2005,2006
+# 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
@@ -89,7 +90,7 @@ distribute += $(filter-out $(generated),$(long-m-yes:=.c) $(long-c-yes:=.c))
# Rules for the test suite.
tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \
test-misc test-fpucw tst-definitions test-tgmath test-tgmath-ret \
- bug-nextafter bug-nexttoward bug-tgmath1
+ bug-nextafter bug-nexttoward bug-tgmath1 test-tgmath-int
# We do the `long double' tests only if this data type is available and
# distinct from `double'.
test-longdouble-yes = test-ldouble test-ildoubl
@@ -107,7 +108,7 @@ generated += $(libm-tests-generated) libm-test.stmp
# This is needed for dependencies
before-compile += $(objpfx)libm-test.c
-ulps-file = $(firstword $(wildcard $(config-sysdirs:%=$(..)%/libm-test-ulps)))
+ulps-file = $(firstword $(wildcard $(sysdirs:%=%/libm-test-ulps)))
$(addprefix $(objpfx), $(libm-tests-generated)): $(objpfx)libm-test.stmp
@@ -149,6 +150,15 @@ distribute += ieee-math.c
include ../Rules
+# The generated sysd-rules file defines rules like this for sources
+# coming from sysdeps/ directories. These rules find the generic sources.
+define o-iterator-doit
+$(objpfx)m_%$o: s_%.c $(before-compile); $$(compile-command.c)
+endef
+object-suffixes-left := $(all-object-suffixes)
+include $(o-iterator)
+
+
# This file defines the default _LIB_VERSION variable that controls
# the error return conventions for the math functions.
CPPFLAGS-s_lib_version.c := -D_POSIX_MODE
diff --git a/math/Versions b/math/Versions
index bd24fc6698..39c47626f6 100644
--- a/math/Versions
+++ b/math/Versions
@@ -94,7 +94,7 @@ libm {
}
GLIBC_2.1 {
# mathematical functions
- exp2; exp2f; exp2l;
+ exp2; exp2f; # exp2l; -- bug omitted this until GLIBC_2.4 (below)
exp10; exp10f; exp10l;
fdim; fdimf; fdiml;
fma; fmaf; fmal;
@@ -161,4 +161,11 @@ libm {
# fp environment function
feenableexcept; fedisableexcept; fegetexcept;
}
+ GLIBC_2.4 {
+ # A bug in sysdeps/generic/w_exp2.c kept this from appearing
+ # in GLIBC_2.1 as it should have on platforms using that
+ # implementation file. On others, sysdeps/CPU/Versions now
+ # puts exp2l in GLIBC_2.1, which will override this entry.
+ exp2l;
+ }
}
diff --git a/math/basic-test.c b/math/basic-test.c
index e42c014572..e48a3ae4e0 100644
--- a/math/basic-test.c
+++ b/math/basic-test.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1999.
@@ -44,7 +44,7 @@ NAME (void) \
\
zero_var = 0.0; \
one_var = 1.0; \
- NaN_var = zero_var/zero_var; \
+ NaN_var = zero_var / zero_var; \
Inf_var = one_var / zero_var; \
\
(void) &zero_var; \
@@ -103,21 +103,51 @@ NAME (void) \
check (#FLOAT " isinf (-HUGE_VALx) == -1", isinf (x1) == -1); \
}
+#define TEST_TRUNC(NAME, FLOAT, DOUBLE) \
+void \
+NAME (void) \
+{ \
+ volatile DOUBLE Inf_var, NaN_var, zero_var, one_var; \
+ FLOAT x1, x2; \
+ \
+ zero_var = 0.0; \
+ one_var = 1.0; \
+ NaN_var = zero_var / zero_var; \
+ Inf_var = one_var / zero_var; \
+ \
+ (void) &NaN_var; \
+ (void) &Inf_var; \
+ \
+ x1 = (FLOAT) NaN_var; \
+ check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") NaN", isnan (x1) != 0); \
+ x2 = (FLOAT) Inf_var; \
+ check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") Inf", isinf (x2) != 0); \
+}
+
TEST_FUNC (float_test, float, nanf, FLT_EPSILON, HUGE_VALF)
TEST_FUNC (double_test, double, nan, DBL_EPSILON, HUGE_VAL)
+TEST_TRUNC (truncdfsf_test, float, double)
#ifndef NO_LONG_DOUBLE
TEST_FUNC (ldouble_test, long double, nanl, LDBL_EPSILON, HUGE_VALL)
+TEST_TRUNC (trunctfsf_test, float, long double)
+TEST_TRUNC (trunctfdf_test, double, long double)
#endif
int
-main (void)
+do_test (void)
{
float_test ();
double_test ();
+ truncdfsf_test();
#ifndef NO_LONG_DOUBLE
ldouble_test ();
+ trunctfsf_test();
+ trunctfdf_test();
#endif
return errors != 0;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index 75b2f74556..64da6276f6 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -1,5 +1,5 @@
/* Prototype declarations for math functions; helper file for <math.h>.
- Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996-2002, 2003, 2006 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
@@ -281,7 +281,7 @@ __MATHCALL (rint,, (_Mdouble_ __x));
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
-# ifdef __USE_ISOC99
+# if defined __USE_ISOC99 && !defined __LDBL_COMPAT
__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
# endif
@@ -353,10 +353,13 @@ __MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
/* Multiply-add function computed as a ternary operation. */
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
+#endif /* Use ISO C99. */
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
__END_NAMESPACE_C99
+#endif
-# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* Return X times (2 to the Nth power). */
__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
-# endif
-#endif /* Use ISO C99. */
+#endif
diff --git a/math/bug-nextafter.c b/math/bug-nextafter.c
index 2a967c75bf..1d21841ea6 100644
--- a/math/bug-nextafter.c
+++ b/math/bug-nextafter.c
@@ -4,6 +4,9 @@
#include <stdlib.h>
#include <stdio.h>
+float zero = 0.0;
+float inf = INFINITY;
+
int
main (void)
{
@@ -34,6 +37,81 @@ main (void)
++result;
}
+ i = 0;
+ m = FLT_MIN;
+ feclearexcept (FE_ALL_EXCEPT);
+ i = nextafterf (m, i);
+ if (i < 0 || i >= FLT_MIN)
+ {
+ puts ("nextafterf+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterf+ did not underflow");
+ ++result;
+ }
+ i = 0;
+ feclearexcept (FE_ALL_EXCEPT);
+ i = nextafterf (-m, -i);
+ if (i > 0 || i <= -FLT_MIN)
+ {
+ puts ("nextafterf- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterf- did not underflow");
+ ++result;
+ }
+ i = -INFINITY;
+ feclearexcept (FE_ALL_EXCEPT);
+ m = nextafterf (zero, inf);
+ if (m < 0.0 || m >= FLT_MIN)
+ {
+ puts ("nextafterf+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterf+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nextafterf (m, i) != 0.0)
+ {
+ puts ("nextafterf+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterf+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ m = nextafterf (copysignf (zero, -1.0), -inf);
+ if (m > 0.0 || m <= -FLT_MIN)
+ {
+ puts ("nextafterf- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterf- did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nextafterf (m, -i) != 0.0)
+ {
+ puts ("nextafterf- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterf- did not underflow");
+ ++result;
+ }
+
double di = INFINITY;
double dm = DBL_MAX;
feclearexcept (FE_ALL_EXCEPT);
@@ -59,5 +137,182 @@ main (void)
++result;
}
+ di = 0;
+ dm = DBL_MIN;
+ feclearexcept (FE_ALL_EXCEPT);
+ di = nextafter (dm, di);
+ if (di < 0 || di >= DBL_MIN)
+ {
+ puts ("nextafter+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafter+ did not underflow");
+ ++result;
+ }
+ di = 0;
+ feclearexcept (FE_ALL_EXCEPT);
+ di = nextafter (-dm, -di);
+ if (di > 0 || di <= -DBL_MIN)
+ {
+ puts ("nextafter- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafter- did not underflow");
+ ++result;
+ }
+ di = -INFINITY;
+ feclearexcept (FE_ALL_EXCEPT);
+ dm = nextafter (zero, inf);
+ if (dm < 0.0 || dm >= DBL_MIN)
+ {
+ puts ("nextafter+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafter+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nextafter (dm, di) != 0.0)
+ {
+ puts ("nextafter+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafter+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ dm = nextafter (copysign (zero, -1.0), -inf);
+ if (dm > 0.0 || dm <= -DBL_MIN)
+ {
+ puts ("nextafter- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafter- did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nextafter (dm, -di) != 0.0)
+ {
+ puts ("nextafter- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafter- did not underflow");
+ ++result;
+ }
+
+#ifndef NO_LONG_DOUBLE
+ long double li = INFINITY;
+ long double lm = LDBL_MAX;
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nextafterl (lm, li) != li)
+ {
+ puts ("nextafterl+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_OVERFLOW) == 0)
+ {
+ puts ("nextafterl+ did not overflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nextafterl (-lm, -li) != -li)
+ {
+ puts ("nextafterl failed");
+ ++result;
+ }
+ if (fetestexcept (FE_OVERFLOW) == 0)
+ {
+ puts ("nextafterl- did not overflow");
+ ++result;
+ }
+
+ li = 0;
+ lm = LDBL_MIN;
+ feclearexcept (FE_ALL_EXCEPT);
+ li = nextafterl (lm, li);
+ if (li < 0 || li >= LDBL_MIN)
+ {
+ puts ("nextafterl+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterl+ did not underflow");
+ ++result;
+ }
+ li = 0;
+ feclearexcept (FE_ALL_EXCEPT);
+ li = nextafterl (-lm, -li);
+ if (li > 0 || li <= -LDBL_MIN)
+ {
+ puts ("nextafterl- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterl- did not underflow");
+ ++result;
+ }
+ li = -INFINITY;
+ feclearexcept (FE_ALL_EXCEPT);
+ lm = nextafterl (zero, inf);
+ if (lm < 0.0 || lm >= LDBL_MIN)
+ {
+ puts ("nextafterl+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterl+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nextafterl (lm, li) != 0.0)
+ {
+ puts ("nextafterl+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterl+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ lm = nextafterl (copysign (zero, -1.0), -inf);
+ if (lm > 0.0 || lm <= -LDBL_MIN)
+ {
+ puts ("nextafterl- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterl- did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nextafterl (lm, -li) != 0.0)
+ {
+ puts ("nextafterl- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nextafterl- did not underflow");
+ ++result;
+ }
+#endif
+
return result;
}
diff --git a/math/bug-nexttoward.c b/math/bug-nexttoward.c
index e306a129c2..ff57e5e3f5 100644
--- a/math/bug-nexttoward.c
+++ b/math/bug-nexttoward.c
@@ -4,6 +4,9 @@
#include <stdlib.h>
#include <stdio.h>
+float zero = 0.0;
+float inf = INFINITY;
+
int
main (void)
{
@@ -35,6 +38,81 @@ main (void)
++result;
}
+ fi = 0;
+ m = FLT_MIN;
+ feclearexcept (FE_ALL_EXCEPT);
+ fi = nexttowardf (m, fi);
+ if (fi < 0 || fi >= FLT_MIN)
+ {
+ puts ("nexttowardf+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardf+ did not underflow");
+ ++result;
+ }
+ fi = 0;
+ feclearexcept (FE_ALL_EXCEPT);
+ fi = nexttowardf (-m, -fi);
+ if (fi > 0 || fi <= -FLT_MIN)
+ {
+ puts ("nexttowardf- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardf- did not underflow");
+ ++result;
+ }
+ fi = -INFINITY;
+ feclearexcept (FE_ALL_EXCEPT);
+ m = nexttowardf (zero, inf);
+ if (m < 0.0 || m >= FLT_MIN)
+ {
+ puts ("nexttowardf+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardf+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nexttowardf (m, fi) != 0.0)
+ {
+ puts ("nexttowardf+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardf+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ m = nexttowardf (copysignf (zero, -1.0), -inf);
+ if (m > 0.0 || m <= -FLT_MIN)
+ {
+ puts ("nexttowardf- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardf- did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nexttowardf (m, -fi) != 0.0)
+ {
+ puts ("nexttowardf- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardf- did not underflow");
+ ++result;
+ }
+
tl = (long double) DBL_MAX + 1.0e305L;
double di = INFINITY;
double dm = DBL_MAX;
@@ -61,5 +139,182 @@ main (void)
++result;
}
+ di = 0;
+ dm = DBL_MIN;
+ feclearexcept (FE_ALL_EXCEPT);
+ di = nexttoward (dm, di);
+ if (di < 0 || di >= DBL_MIN)
+ {
+ puts ("nexttoward+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttoward+ did not underflow");
+ ++result;
+ }
+ di = 0;
+ feclearexcept (FE_ALL_EXCEPT);
+ di = nexttoward (-dm, -di);
+ if (di > 0 || di <= -DBL_MIN)
+ {
+ puts ("nexttoward- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttoward- did not underflow");
+ ++result;
+ }
+ di = -INFINITY;
+ feclearexcept (FE_ALL_EXCEPT);
+ dm = nexttoward (zero, inf);
+ if (dm < 0.0 || dm >= DBL_MIN)
+ {
+ puts ("nexttoward+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttoward+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nexttoward (dm, di) != 0.0)
+ {
+ puts ("nexttoward+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttoward+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ dm = nexttoward (copysign (zero, -1.0), -inf);
+ if (dm > 0.0 || dm <= -DBL_MIN)
+ {
+ puts ("nexttoward- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttoward- did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nexttoward (dm, -di) != 0.0)
+ {
+ puts ("nexttoward- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttoward- did not underflow");
+ ++result;
+ }
+
+#ifndef NO_LONG_DOUBLE
+ long double li = INFINITY;
+ long double lm = LDBL_MAX;
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nexttowardl (lm, li) != li)
+ {
+ puts ("nexttowardl+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_OVERFLOW) == 0)
+ {
+ puts ("nexttowardl+ did not overflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nexttowardl (-lm, -li) != -li)
+ {
+ puts ("nexttowardl failed");
+ ++result;
+ }
+ if (fetestexcept (FE_OVERFLOW) == 0)
+ {
+ puts ("nexttowardl- did not overflow");
+ ++result;
+ }
+
+ li = 0;
+ lm = LDBL_MIN;
+ feclearexcept (FE_ALL_EXCEPT);
+ li = nexttowardl (lm, li);
+ if (li < 0 || li >= LDBL_MIN)
+ {
+ puts ("nexttowardl+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardl+ did not underflow");
+ ++result;
+ }
+ li = 0;
+ feclearexcept (FE_ALL_EXCEPT);
+ li = nexttowardl (-lm, -li);
+ if (li > 0 || li <= -LDBL_MIN)
+ {
+ puts ("nexttowardl- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardl- did not underflow");
+ ++result;
+ }
+ li = -INFINITY;
+ feclearexcept (FE_ALL_EXCEPT);
+ lm = nexttowardl (zero, inf);
+ if (lm < 0.0 || lm >= LDBL_MIN)
+ {
+ puts ("nexttowardl+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardl+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nexttowardl (lm, li) != 0.0)
+ {
+ puts ("nexttowardl+ failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardl+ did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ lm = nexttowardl (copysign (zero, -1.0), -inf);
+ if (lm > 0.0 || lm <= -LDBL_MIN)
+ {
+ puts ("nexttowardl- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardl- did not underflow");
+ ++result;
+ }
+ feclearexcept (FE_ALL_EXCEPT);
+ if (nexttowardl (lm, -li) != 0.0)
+ {
+ puts ("nexttowardl- failed");
+ ++result;
+ }
+ if (fetestexcept (FE_UNDERFLOW) == 0)
+ {
+ puts ("nexttowardl- did not underflow");
+ ++result;
+ }
+#endif
+
return result;
}
diff --git a/math/cabsf.c b/math/cabsf.c
new file mode 100644
index 0000000000..956db76ba1
--- /dev/null
+++ b/math/cabsf.c
@@ -0,0 +1,29 @@
+/* Return the complex absolute value of float complex value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+float
+__cabsf (float _Complex z)
+{
+ return __hypotf (__real__ z, __imag__ z);
+}
+weak_alias (__cabsf, cabsf)
diff --git a/math/cargf.c b/math/cargf.c
new file mode 100644
index 0000000000..df1f20bc48
--- /dev/null
+++ b/math/cargf.c
@@ -0,0 +1,29 @@
+/* Compute argument of complex float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+float
+__cargf (__complex__ float x)
+{
+ return __atan2f (__imag__ x, __real__ x);
+}
+weak_alias (__cargf, cargf)
diff --git a/math/cimagf.c b/math/cimagf.c
new file mode 100644
index 0000000000..d4e441e69f
--- /dev/null
+++ b/math/cimagf.c
@@ -0,0 +1,28 @@
+/* Return imaginary part of complex float value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+
+float
+__cimagf (float _Complex z)
+{
+ return __imag__ z;
+}
+weak_alias (__cimagf, cimagf)
diff --git a/math/complex.h b/math/complex.h
index f005a93912..751aaf763f 100644
--- a/math/complex.h
+++ b/math/complex.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2006 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
@@ -84,7 +84,14 @@ __BEGIN_DECLS
/* And the long double versions. It is non-critical to define them
here unconditionally since `long double' is required in ISO C99. */
-#if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH
+#if (__STDC__ - 0 || __GNUC__ - 0) \
+ && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
+# ifdef __LDBL_COMPAT
+# undef __MATHDECL_1
+# define __MATHDECL_1(type, function, args) \
+ extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function)
+# endif
+
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
diff --git a/math/conjf.c b/math/conjf.c
new file mode 100644
index 0000000000..7893891933
--- /dev/null
+++ b/math/conjf.c
@@ -0,0 +1,28 @@
+/* Return complex conjugate of complex float value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+
+float _Complex
+__conjf (float _Complex z)
+{
+ return ~z;
+}
+weak_alias (__conjf, conjf)
diff --git a/math/crealf.c b/math/crealf.c
new file mode 100644
index 0000000000..e3235a874f
--- /dev/null
+++ b/math/crealf.c
@@ -0,0 +1,28 @@
+/* Return real part of complex float value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+
+float
+__crealf (float _Complex z)
+{
+ return __real__ z;
+}
+weak_alias (__crealf, crealf)
diff --git a/math/divtc3.c b/math/divtc3.c
new file mode 100644
index 0000000000..d974ae6454
--- /dev/null
+++ b/math/divtc3.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson <rth@redhat.com>, 2005.
+
+ 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 <stdbool.h>
+#include <math.h>
+#include <complex.h>
+
+attribute_hidden
+long double _Complex
+__divtc3 (long double a, long double b, long double c, long double d)
+{
+ long double denom, ratio, x, y;
+
+ /* ??? We can get better behavior from logarithmic scaling instead of
+ the division. But that would mean starting to link libgcc against
+ libm. We could implement something akin to ldexp/frexp as gcc builtins
+ fairly easily... */
+ if (fabsl (c) < fabsl (d))
+ {
+ ratio = c / d;
+ denom = (c * ratio) + d;
+ x = ((a * ratio) + b) / denom;
+ y = ((b * ratio) - a) / denom;
+ }
+ else
+ {
+ ratio = d / c;
+ denom = (d * ratio) + c;
+ x = ((b * ratio) + a) / denom;
+ y = (b - (a * ratio)) / denom;
+ }
+
+ /* Recover infinities and zeros that computed as NaN+iNaN; the only cases
+ are nonzero/zero, infinite/finite, and finite/infinite. */
+ if (isnan (x) && isnan (y))
+ {
+ if (denom == 0.0 && (!isnan (a) || !isnan (b)))
+ {
+ x = __copysignl (INFINITY, c) * a;
+ y = __copysignl (INFINITY, c) * b;
+ }
+ else if ((isinf (a) || isinf (b)) && isfinite (c) && isfinite (d))
+ {
+ a = __copysignl (isinf (a) ? 1 : 0, a);
+ b = __copysignl (isinf (b) ? 1 : 0, b);
+ x = INFINITY * (a * c + b * d);
+ y = INFINITY * (b * c - a * d);
+ }
+ else if ((isinf (c) || isinf (d)) && isfinite (a) && isfinite (b))
+ {
+ c = __copysignl (isinf (c) ? 1 : 0, c);
+ d = __copysignl (isinf (d) ? 1 : 0, d);
+ x = 0.0 * (a * c + b * d);
+ y = 0.0 * (b * c - a * d);
+ }
+ }
+
+ return x + I * y;
+}
diff --git a/math/e_acoshl.c b/math/e_acoshl.c
new file mode 100644
index 0000000000..2c2fbe8eb4
--- /dev/null
+++ b/math/e_acoshl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_acoshl (long double x)
+{
+ fputs ("__ieee754_acoshl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (acoshl)
+#include <stub-tag.h>
diff --git a/math/e_acosl.c b/math/e_acosl.c
new file mode 100644
index 0000000000..d844d885b8
--- /dev/null
+++ b/math/e_acosl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_acosl (long double x)
+{
+ fputs ("__ieee754_acosl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (acosl)
+#include <stub-tag.h>
diff --git a/math/e_asinl.c b/math/e_asinl.c
new file mode 100644
index 0000000000..3b26f030ef
--- /dev/null
+++ b/math/e_asinl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_asinl (long double x)
+{
+ fputs ("__ieee754_asinl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (asinl)
+#include <stub-tag.h>
diff --git a/math/e_atan2l.c b/math/e_atan2l.c
new file mode 100644
index 0000000000..0caed8a32f
--- /dev/null
+++ b/math/e_atan2l.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_atan2l (long double x, long double y)
+{
+ fputs ("__ieee754_atan2l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (atan2l)
+#include <stub-tag.h>
diff --git a/math/e_atanhl.c b/math/e_atanhl.c
new file mode 100644
index 0000000000..625d42db31
--- /dev/null
+++ b/math/e_atanhl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_atanhl (long double x)
+{
+ fputs ("__ieee754_atanhl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__ieee754_atanhl)
+#include <stub-tag.h>
diff --git a/math/e_coshl.c b/math/e_coshl.c
new file mode 100644
index 0000000000..0da319b785
--- /dev/null
+++ b/math/e_coshl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_coshl (long double x)
+{
+ fputs ("__ieee754_coshl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__ieee754_coshl)
+#include <stub-tag.h>
diff --git a/math/e_exp10.c b/math/e_exp10.c
new file mode 100644
index 0000000000..a3eccbb9e6
--- /dev/null
+++ b/math/e_exp10.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ 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 <math.h>
+#include "math_private.h"
+
+
+double
+__ieee754_exp10 (double arg)
+{
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_exp (M_LN10 * arg);
+}
diff --git a/math/e_exp10f.c b/math/e_exp10f.c
new file mode 100644
index 0000000000..7d06d074b8
--- /dev/null
+++ b/math/e_exp10f.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ 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 <math.h>
+#include "math_private.h"
+
+
+float
+__ieee754_exp10f (float arg)
+{
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_expf (M_LN10 * arg);
+}
diff --git a/math/e_exp10l.c b/math/e_exp10l.c
new file mode 100644
index 0000000000..56f0cfec2f
--- /dev/null
+++ b/math/e_exp10l.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ 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 <math.h>
+#include "math_private.h"
+
+
+long double
+__ieee754_exp10l (long double arg)
+{
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_expl (M_LN10l * arg);
+}
diff --git a/math/e_exp2l.c b/math/e_exp2l.c
new file mode 100644
index 0000000000..7e598d8d2d
--- /dev/null
+++ b/math/e_exp2l.c
@@ -0,0 +1,10 @@
+#include <math.h>
+#include "math_private.h"
+
+long double
+__ieee754_exp2l (long double x)
+{
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_expl (M_LN2l * x);
+}
diff --git a/math/e_expl.c b/math/e_expl.c
new file mode 100644
index 0000000000..f9467c38ab
--- /dev/null
+++ b/math/e_expl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_expl (long double x)
+{
+ fputs ("__ieee754_expl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (expl)
+#include <stub-tag.h>
diff --git a/math/e_fmodl.c b/math/e_fmodl.c
new file mode 100644
index 0000000000..380da24e41
--- /dev/null
+++ b/math/e_fmodl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_fmodl (long double x, long double y)
+{
+ fputs ("__ieee754_fmodl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (fmodl)
+#include <stub-tag.h>
diff --git a/math/e_gammal_r.c b/math/e_gammal_r.c
new file mode 100644
index 0000000000..1c45c8421b
--- /dev/null
+++ b/math/e_gammal_r.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_gammal_r (long double x, int *signgamp)
+{
+ *signgamp = 0;
+ fputs ("__ieee754_gammal_r not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__ieee754_gammal_r)
+#include <stub-tag.h>
diff --git a/math/e_hypotl.c b/math/e_hypotl.c
new file mode 100644
index 0000000000..07df22eb36
--- /dev/null
+++ b/math/e_hypotl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_hypotl (long double x, long double y)
+{
+ fputs ("__ieee754_hypotl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__ieee754_hypotl)
+#include <stub-tag.h>
diff --git a/math/e_j0l.c b/math/e_j0l.c
new file mode 100644
index 0000000000..1bf0a1de73
--- /dev/null
+++ b/math/e_j0l.c
@@ -0,0 +1,25 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__ieee754_j0l (long double x)
+{
+ fputs ("__ieee754_j0l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (j0l)
+
+long double
+__ieee754_y0l (long double x)
+{
+ fputs ("__ieee754_y0l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (y0l)
+#include <stub-tag.h>
diff --git a/math/e_j1l.c b/math/e_j1l.c
new file mode 100644
index 0000000000..656abeba57
--- /dev/null
+++ b/math/e_j1l.c
@@ -0,0 +1,25 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__ieee754_j1l (long double x)
+{
+ fputs ("__ieee754_j1l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (j1l)
+
+long double
+__ieee754_y1l (long double x)
+{
+ fputs ("__ieee754_y1l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (y1l)
+#include <stub-tag.h>
diff --git a/math/e_jnl.c b/math/e_jnl.c
new file mode 100644
index 0000000000..1bfc0695a5
--- /dev/null
+++ b/math/e_jnl.c
@@ -0,0 +1,25 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__ieee754_jnl (int n, long double x)
+{
+ fputs ("__ieee754_jnl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (jnl)
+
+long double
+__ieee754_ynl (int n, long double x)
+{
+ fputs ("__ieee754_ynl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (ynl)
+#include <stub-tag.h>
diff --git a/math/e_lgammal_r.c b/math/e_lgammal_r.c
new file mode 100644
index 0000000000..1784b2663f
--- /dev/null
+++ b/math/e_lgammal_r.c
@@ -0,0 +1,17 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__ieee754_lgammal_r (long double x, int *signgamp)
+{
+ *signgamp = 0;
+ fputs ("__ieee754_lgammal_r not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (lgammal)
+stub_warning (lgammal_r)
+#include <stub-tag.h>
diff --git a/math/e_log10l.c b/math/e_log10l.c
new file mode 100644
index 0000000000..5bc264b32c
--- /dev/null
+++ b/math/e_log10l.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_log10l (long double x)
+{
+ fputs ("__ieee754_log10l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (log10l)
+#include <stub-tag.h>
diff --git a/math/e_log2l.c b/math/e_log2l.c
new file mode 100644
index 0000000000..681904bfbb
--- /dev/null
+++ b/math/e_log2l.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_log2l (long double x)
+{
+ fputs ("__ieee754_log2l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (log2l)
+#include <stub-tag.h>
diff --git a/math/e_logl.c b/math/e_logl.c
new file mode 100644
index 0000000000..9ba9cfc799
--- /dev/null
+++ b/math/e_logl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_logl (long double x)
+{
+ fputs ("__ieee754_logl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (logl)
+#include <stub-tag.h>
diff --git a/math/e_powl.c b/math/e_powl.c
new file mode 100644
index 0000000000..afc2248b6b
--- /dev/null
+++ b/math/e_powl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_powl (long double x, long double y)
+{
+ fputs ("__ieee754_powl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (powl)
+#include <stub-tag.h>
diff --git a/math/e_rem_pio2l.c b/math/e_rem_pio2l.c
new file mode 100644
index 0000000000..617215516b
--- /dev/null
+++ b/math/e_rem_pio2l.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+int
+__ieee754_rem_pio2l (long double x, long double *y)
+{
+ fputs ("__ieee754_rem_pio2l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0;
+}
+
+stub_warning (__ieee754_rem_pio2l)
+#include <stub-tag.h>
diff --git a/math/e_scalb.c b/math/e_scalb.c
new file mode 100644
index 0000000000..606af53724
--- /dev/null
+++ b/math/e_scalb.c
@@ -0,0 +1,71 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * __ieee754_scalb(x, fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbn() instead.
+ */
+
+#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
+{
+#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
+}
diff --git a/math/e_scalbf.c b/math/e_scalbf.c
new file mode 100644
index 0000000000..95a72eb56d
--- /dev/null
+++ b/math/e_scalbf.c
@@ -0,0 +1,68 @@
+/* e_scalbf.c -- float version of e_scalb.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+#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
+{
+#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
+}
diff --git a/math/e_scalbl.c b/math/e_scalbl.c
new file mode 100644
index 0000000000..1f5677d9f4
--- /dev/null
+++ b/math/e_scalbl.c
@@ -0,0 +1,75 @@
+/* e_scalbl.c -- long double version of s_scalb.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * __ieee754_scalbl(x, fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbnl() instead.
+ */
+
+#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
+{
+#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
+}
diff --git a/math/e_sinhl.c b/math/e_sinhl.c
new file mode 100644
index 0000000000..4cec79cb2d
--- /dev/null
+++ b/math/e_sinhl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_sinhl (long double x)
+{
+ fputs ("__ieee754_sinhl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__ieee754_sinhl)
+#include <stub-tag.h>
diff --git a/math/e_sqrtl.c b/math/e_sqrtl.c
new file mode 100644
index 0000000000..7680bdb145
--- /dev/null
+++ b/math/e_sqrtl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_sqrtl (long double x)
+{
+ fputs ("__ieee754_sqrtl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (sqrtl)
+#include <stub-tag.h>
diff --git a/math/fclrexcpt.c b/math/fclrexcpt.c
new file mode 100644
index 0000000000..560e326ee3
--- /dev/null
+++ b/math/fclrexcpt.c
@@ -0,0 +1,37 @@
+/* Clear given exceptions in current floating-point environment.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <shlib-compat.h>
+
+int
+__feclearexcept (int excepts)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feclearexcept, __old_feclearexcept)
+compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
+#endif
+versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
+
+stub_warning (feclearexcept)
+#include <stub-tag.h>
diff --git a/math/fedisblxcpt.c b/math/fedisblxcpt.c
new file mode 100644
index 0000000000..e1e9065aac
--- /dev/null
+++ b/math/fedisblxcpt.c
@@ -0,0 +1,30 @@
+/* Disable floating-point exceptions.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+ 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>
+
+int
+fedisableexcept (int excepts)
+{
+ /* Signal failure. */
+ return -1;
+}
+stub_warning (fedisableexcept)
+#include <stub-tag.h>
diff --git a/math/feenablxcpt.c b/math/feenablxcpt.c
new file mode 100644
index 0000000000..678271f360
--- /dev/null
+++ b/math/feenablxcpt.c
@@ -0,0 +1,30 @@
+/* Enable floating-point exceptions.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+ 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>
+
+int
+feenableexcept (int excepts)
+{
+ /* Signal failure. */
+ return -1;
+}
+stub_warning (feenableexcept)
+#include <stub-tag.h>
diff --git a/math/fegetenv.c b/math/fegetenv.c
new file mode 100644
index 0000000000..4a878cc41b
--- /dev/null
+++ b/math/fegetenv.c
@@ -0,0 +1,38 @@
+/* Store current floating-point environment.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <shlib-compat.h>
+#include <bp-sym.h>
+
+int
+__fegetenv (fenv_t *envp)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fegetenv, __old_fegetenv)
+compat_symbol (libm, BP_SYM (__old_fegetenv), BP_SYM (fegetenv), GLIBC_2_1);
+#endif
+versioned_symbol (libm, BP_SYM (__fegetenv), BP_SYM (fegetenv), GLIBC_2_2);
+
+stub_warning (fegetenv)
+#include <stub-tag.h>
diff --git a/math/fegetexcept.c b/math/fegetexcept.c
new file mode 100644
index 0000000000..1870689e8d
--- /dev/null
+++ b/math/fegetexcept.c
@@ -0,0 +1,30 @@
+/* Get floating-point exceptions.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+ 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>
+
+int
+fegetexcept (void)
+{
+ /* Signal failure. */
+ return -1;
+}
+stub_warning (fegetexcept)
+#include <stub-tag.h>
diff --git a/math/fegetround.c b/math/fegetround.c
new file mode 100644
index 0000000000..cf7a774929
--- /dev/null
+++ b/math/fegetround.c
@@ -0,0 +1,29 @@
+/* Return current rounding direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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>
+
+int
+fegetround (void)
+{
+ return 0;
+}
+stub_warning (fegetround)
+#include <stub-tag.h>
diff --git a/math/feholdexcpt.c b/math/feholdexcpt.c
new file mode 100644
index 0000000000..8680d1e492
--- /dev/null
+++ b/math/feholdexcpt.c
@@ -0,0 +1,30 @@
+/* Store current floating-point environment and clear exceptions.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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>
+
+int
+feholdexcept (fenv_t *envp)
+{
+ return 1; /* Signal failure. */
+}
+libm_hidden_def (feholdexcept)
+stub_warning (feholdexcept)
+#include <stub-tag.h>
diff --git a/math/fesetenv.c b/math/fesetenv.c
new file mode 100644
index 0000000000..936d6c121b
--- /dev/null
+++ b/math/fesetenv.c
@@ -0,0 +1,38 @@
+/* Install given floating-point environment.
+ Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <shlib-compat.h>
+
+int
+__fesetenv (const fenv_t *envp)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fesetenv, __old_fesetenv)
+compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1);
+#endif
+libm_hidden_ver (__fesetenv, fesetenv)
+versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2);
+
+stub_warning (fesetenv)
+#include <stub-tag.h>
diff --git a/math/fesetround.c b/math/fesetround.c
new file mode 100644
index 0000000000..5b14826390
--- /dev/null
+++ b/math/fesetround.c
@@ -0,0 +1,30 @@
+/* Set current rounding direction.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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>
+
+int
+fesetround (int round)
+{
+ return 1; /* Signal we are unable to set the direction. */
+}
+libm_hidden_def (fesetround)
+stub_warning (fesetround)
+#include <stub-tag.h>
diff --git a/math/feupdateenv.c b/math/feupdateenv.c
new file mode 100644
index 0000000000..3e6aed4fdf
--- /dev/null
+++ b/math/feupdateenv.c
@@ -0,0 +1,37 @@
+/* Install given floating-point environment and raise exceptions.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <shlib-compat.h>
+
+int
+__feupdateenv (const fenv_t *envp)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feupdateenv, __old_feupdateenv)
+compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
+#endif
+versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
+
+stub_warning (feupdateenv)
+#include <stub-tag.h>
diff --git a/math/fgetexcptflg.c b/math/fgetexcptflg.c
new file mode 100644
index 0000000000..aea2e0ffaf
--- /dev/null
+++ b/math/fgetexcptflg.c
@@ -0,0 +1,37 @@
+/* Store current representation for exceptions.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <shlib-compat.h>
+
+int
+__fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fegetexceptflag, __old_fegetexceptflag)
+compat_symbol (libm, __old_fegetexceptflag, fegetexceptflag, GLIBC_2_1);
+#endif
+versioned_symbol (libm, __fegetexceptflag, fegetexceptflag, GLIBC_2_2);
+
+stub_warning (fegetexceptflag)
+#include <stub-tag.h>
diff --git a/math/fpu_control.c b/math/fpu_control.c
new file mode 100644
index 0000000000..cd8eeff99d
--- /dev/null
+++ b/math/fpu_control.c
@@ -0,0 +1,25 @@
+/* Default FPU control word initialization.
+ Copyright (C) 1996, 1997, 1999 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. */
+
+#include <math.h>
+#include <fpu_control.h>
+
+/* This module defines `__fpu_control' with the default value. */
+
+fpu_control_t __fpu_control = _FPU_DEFAULT;
diff --git a/math/fraiseexcpt.c b/math/fraiseexcpt.c
new file mode 100644
index 0000000000..764634a3b1
--- /dev/null
+++ b/math/fraiseexcpt.c
@@ -0,0 +1,38 @@
+/* Raise given exceptions.
+ Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <shlib-compat.h>
+
+int
+__feraiseexcept (int excepts)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feraiseexcept, __old_feraiseexcept)
+compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
+#endif
+libm_hidden_ver (__feraiseexcept, feraiseexcept)
+versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
+
+stub_warning (feraiseexcept)
+#include <stub-tag.h>
diff --git a/math/fsetexcptflg.c b/math/fsetexcptflg.c
new file mode 100644
index 0000000000..8d0f0ff64b
--- /dev/null
+++ b/math/fsetexcptflg.c
@@ -0,0 +1,37 @@
+/* Set floating-point environment exception handling.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <shlib-compat.h>
+
+int
+__fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fesetexceptflag, __old_fesetexceptflag)
+compat_symbol (libm, __old_fesetexceptflag, fesetexceptflag, GLIBC_2_1);
+#endif
+versioned_symbol (libm, __fesetexceptflag, fesetexceptflag, GLIBC_2_2);
+
+stub_warning (fesetexceptflag)
+#include <stub-tag.h>
diff --git a/math/ftestexcept.c b/math/ftestexcept.c
new file mode 100644
index 0000000000..4be3fb770f
--- /dev/null
+++ b/math/ftestexcept.c
@@ -0,0 +1,29 @@
+/* Test exception in current environment.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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>
+
+int
+fetestexcept (int excepts)
+{
+ return 0;
+}
+stub_warning (fetestexcept)
+#include <stub-tag.h>
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index 26f819a884..0b0b8ca19f 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-# Copyright (C) 1999 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Andreas Jaeger <aj@suse.de>, 1999.
@@ -234,7 +234,7 @@ sub special_functions {
# Parse the arguments to TEST_x_y
sub parse_args {
- my ($file, $descr, $args) = @_;
+ my ($file, $descr, $fct, $args) = @_;
my (@args, $str, $descr_args, $descr_res, @descr);
my ($current_arg, $cline, $i);
my ($pre, $post, @special);
@@ -248,7 +248,7 @@ sub parse_args {
@args = split /,\s*/, $args;
- $call = "$args[0] (";
+ $call = "$fct (";
# Generate first the string that's shown to the user
$current_arg = 1;
@@ -423,7 +423,7 @@ sub parse_args {
sub generate_testfile {
my ($input, $output) = @_;
my ($lasttext);
- my (@args, $i, $str);
+ my (@args, $i, $str, $thisfct);
open INPUT, $input or die ("Can't open $input: $!");
open OUTPUT, ">$output" or die ("Can't open $output: $!");
@@ -436,11 +436,12 @@ sub generate_testfile {
my ($descr, $args);
chop;
($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
- &parse_args (\*OUTPUT, $descr, $args);
+ &parse_args (\*OUTPUT, $descr, $thisfct, $args);
next;
}
# START (function)
if (/START/) {
+ ($thisfct) = ($_ =~ /START\s*\((.*)\)/);
print OUTPUT " init_max_error ();\n";
next;
}
@@ -557,9 +558,11 @@ sub parse_ulps {
sub clean_up_number {
my ($number) = @_;
- # Remove trailing zeros
- $number =~ s/0+$//;
- $number =~ s/\.$//;
+ # Remove trailing zeros after the decimal point
+ if ($number =~ /\./) {
+ $number =~ s/0+$//;
+ $number =~ s/\.$//;
+ }
return $number;
}
diff --git a/math/k_cosl.c b/math/k_cosl.c
new file mode 100644
index 0000000000..29b83d6273
--- /dev/null
+++ b/math/k_cosl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__kernel_cosl (long double x, long double y)
+{
+ fputs ("__kernel_cosl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__kernel_cosl)
+#include <stub-tag.h>
diff --git a/math/k_rem_pio2l.c b/math/k_rem_pio2l.c
new file mode 100644
index 0000000000..236eb30dd9
--- /dev/null
+++ b/math/k_rem_pio2l.c
@@ -0,0 +1,16 @@
+#include <math.h>
+#include <math_private.h>
+#include <stdio.h>
+#include <errno.h>
+
+int
+__kernel_rem_pio2l (long double *x, long double *y, int e0, int nx, int prec,
+ const int *ipio2)
+{
+ fputs ("__kernel_rem_pio2l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__kernel_rem_pio2l)
+#include <stub-tag.h>
diff --git a/math/k_sincosl.c b/math/k_sincosl.c
new file mode 100644
index 0000000000..aa038c26c4
--- /dev/null
+++ b/math/k_sincosl.c
@@ -0,0 +1 @@
+/* Empty. Not needed. */
diff --git a/math/k_sinl.c b/math/k_sinl.c
new file mode 100644
index 0000000000..ea1d71f61b
--- /dev/null
+++ b/math/k_sinl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__kernel_sinl (long double x, long double y, int iy)
+{
+ fputs ("__kernel_sinl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__kernel_sinl)
+#include <stub-tag.h>
diff --git a/math/k_tanl.c b/math/k_tanl.c
new file mode 100644
index 0000000000..9993c6b998
--- /dev/null
+++ b/math/k_tanl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__kernel_tanl (long double x, long double y, int iy)
+{
+ fputs ("__kernel_tanl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__kernel_tanl)
+#include <stub-tag.h>
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 60711fabdc..81dd364f77 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1997.
@@ -22,7 +22,7 @@
This file is processed by a perl script. The resulting file has to
be included by a master file that defines:
- Makros:
+ Macros:
FUNC(function): converts general function name (like cos) to
name with correct suffix (e.g. cosl or cosf)
MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
@@ -153,6 +153,7 @@
#define M_PI2_LOG10El M_PI_2l * M_LOG10El
#define M_PI4_LOG10El M_PI_4l * M_LOG10El
#define M_PI_LOG10El M_PIl * M_LOG10El
+#define M_SQRT_2_2 0.70710678118654752440084436210484903L /* sqrt (2) / 2 */
static FILE *ulps_file; /* File to document difference. */
static int output_ulps; /* Should ulps printed? */
@@ -497,7 +498,7 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
&& computed == 0.0 && expected == 0.0
&& signbit(computed) != signbit (expected))
ok = 0;
- else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp))
+ else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
ok = 1;
else
{
@@ -1115,7 +1116,7 @@ cacosh_test (void)
TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
- TEST_c_c (cacosh, -2, -3, -1.9833870299165354323470769028940395L, 2.1414491111159960199416055713254211L);
+ TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
END (cacosh, complex);
}
@@ -1627,8 +1628,82 @@ ceil_test (void)
TEST_f_f (ceil, M_PIl, 4.0);
TEST_f_f (ceil, -M_PIl, -3.0);
+ TEST_f_f (ceil, 0.1, 1.0);
TEST_f_f (ceil, 0.25, 1.0);
+ TEST_f_f (ceil, 0.625, 1.0);
+ TEST_f_f (ceil, -0.1, minus_zero);
TEST_f_f (ceil, -0.25, minus_zero);
+ TEST_f_f (ceil, -0.625, minus_zero);
+
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (ceil, 4503599627370494.5000000000001L, 4503599627370495.0L);
+ TEST_f_f (ceil, 4503599627370495.5000000000001L, 4503599627370496.0L);
+ TEST_f_f (ceil, 4503599627370496.5000000000001L, 4503599627370497.0L);
+ TEST_f_f (ceil, -4503599627370494.5000000000001L, -4503599627370494.0L);
+ TEST_f_f (ceil, -4503599627370495.5000000000001L, -4503599627370495.0L);
+ TEST_f_f (ceil, -4503599627370496.5000000000001L, -4503599627370496.0L);
+# endif
+
+ TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
+ TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (ceil, 9007199254740991.0000000000001L, 9007199254740992.0L);
+ TEST_f_f (ceil, 9007199254740992.0000000000001L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740993.0000000000001L, 9007199254740994.0L);
+ TEST_f_f (ceil, 9007199254740991.5000000000001L, 9007199254740992.0L);
+ TEST_f_f (ceil, 9007199254740992.5000000000001L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740993.5000000000001L, 9007199254740994.0L);
+
+ TEST_f_f (ceil, -9007199254740991.0000000000001L, -9007199254740991.0L);
+ TEST_f_f (ceil, -9007199254740992.0000000000001L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740993.0000000000001L, -9007199254740993.0L);
+ TEST_f_f (ceil, -9007199254740991.5000000000001L, -9007199254740991.0L);
+ TEST_f_f (ceil, -9007199254740992.5000000000001L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740993.5000000000001L, -9007199254740993.0L);
+# endif
+
+ TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
+ TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
+
+ TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
END (ceil);
}
@@ -2212,6 +2287,9 @@ csqrt_test (void)
TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
+ /* Principal square root should be returned (i.e., non-negative real
+ part). */
+ TEST_c_c (csqrt, 0, -1, M_SQRT_2_2, -M_SQRT_2_2);
END (csqrt, complex);
}
@@ -2385,7 +2463,9 @@ erfc_test (void)
TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
#ifdef TEST_LDOUBLE
/* The result can only be represented in long double. */
+# if LDBL_MIN_10_EXP < -319
TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
+# endif
#endif
END (erfc);
@@ -2577,8 +2657,85 @@ floor_test (void)
TEST_f_f (floor, M_PIl, 3.0);
TEST_f_f (floor, -M_PIl, -4.0);
+ TEST_f_f (floor, 0.1, 0.0);
TEST_f_f (floor, 0.25, 0.0);
+ TEST_f_f (floor, 0.625, 0.0);
+ TEST_f_f (floor, -0.1, -1.0);
TEST_f_f (floor, -0.25, -1.0);
+ TEST_f_f (floor, -0.625, -1.0);
+
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (floor, 4503599627370494.5000000000001L, 4503599627370494.0L);
+ TEST_f_f (floor, 4503599627370495.5000000000001L, 4503599627370495.0L);
+ TEST_f_f (floor, 4503599627370496.5000000000001L, 4503599627370496.0L);
+# endif
+
+ TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (floor, -4503599627370494.5000000000001L, -4503599627370495.0L);
+ TEST_f_f (floor, -4503599627370495.5000000000001L, -4503599627370496.0L);
+ TEST_f_f (floor, -4503599627370496.5000000000001L, -4503599627370497.0L);
+# endif
+
+ TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L);
+ TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (floor, 9007199254740991.0000000000001L, 9007199254740991.0L);
+ TEST_f_f (floor, 9007199254740992.0000000000001L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740993.0000000000001L, 9007199254740993.0L);
+ TEST_f_f (floor, 9007199254740991.5000000000001L, 9007199254740991.0L);
+ TEST_f_f (floor, 9007199254740992.5000000000001L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740993.5000000000001L, 9007199254740993.0L);
+# endif
+
+ TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (floor, -9007199254740991.0000000000001L, -9007199254740992.0L);
+ TEST_f_f (floor, -9007199254740992.0000000000001L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740993.0000000000001L, -9007199254740994.0L);
+ TEST_f_f (floor, -9007199254740991.5000000000001L, -9007199254740992.0L);
+ TEST_f_f (floor, -9007199254740992.5000000000001L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740993.5000000000001L, -9007199254740994.0L);
+# endif
+
+ TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L);
+ TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
+
+ TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
END (floor);
}
@@ -3116,6 +3273,166 @@ lrint_test (void)
static void
+lrint_test_tonearest (void)
+{
+ int save_round_mode;
+ START (lrint_tonearest);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_TONEAREST))
+ {
+ TEST_f_l (lrint, 0.0, 0);
+ TEST_f_l (lrint, minus_zero, 0);
+ TEST_f_l (lrint, 0.2L, 0);
+ TEST_f_l (lrint, -0.2L, 0);
+ TEST_f_l (lrint, 0.5L, 0);
+ TEST_f_l (lrint, -0.5L, 0);
+ TEST_f_l (lrint, 0.8L, 1);
+ TEST_f_l (lrint, -0.8L, -1);
+
+ TEST_f_l (lrint, 1.4L, 1);
+ TEST_f_l (lrint, -1.4L, -1);
+
+ TEST_f_l (lrint, 8388600.3L, 8388600);
+ TEST_f_l (lrint, -8388600.3L, -8388600);
+
+ TEST_f_l (lrint, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+ TEST_f_l (lrint, 1073741824.01, 1073741824);
+# if LONG_MAX > 281474976710656
+ TEST_f_l (lrint, 281474976710656.025, 281474976710656);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (lrint_tonearest);
+}
+
+
+static void
+lrint_test_towardzero (void)
+{
+ int save_round_mode;
+ START (lrint_towardzero);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_TOWARDZERO))
+ {
+ TEST_f_l (lrint, 0.0, 0);
+ TEST_f_l (lrint, minus_zero, 0);
+ TEST_f_l (lrint, 0.2L, 0);
+ TEST_f_l (lrint, -0.2L, 0);
+ TEST_f_l (lrint, 0.5L, 0);
+ TEST_f_l (lrint, -0.5L, 0);
+ TEST_f_l (lrint, 0.8L, 0);
+ TEST_f_l (lrint, -0.8L, 0);
+
+ TEST_f_l (lrint, 1.4L, 1);
+ TEST_f_l (lrint, -1.4L, -1);
+
+ TEST_f_l (lrint, 8388600.3L, 8388600);
+ TEST_f_l (lrint, -8388600.3L, -8388600);
+
+ TEST_f_l (lrint, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+ TEST_f_l (lrint, 1073741824.01, 1073741824);
+# if LONG_MAX > 281474976710656
+ TEST_f_l (lrint, 281474976710656.025, 281474976710656);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (lrint_towardzero);
+}
+
+
+static void
+lrint_test_downward (void)
+{
+ int save_round_mode;
+ START (lrint_downward);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_DOWNWARD))
+ {
+ TEST_f_l (lrint, 0.0, 0);
+ TEST_f_l (lrint, minus_zero, 0);
+ TEST_f_l (lrint, 0.2L, 0);
+ TEST_f_l (lrint, -0.2L, -1);
+ TEST_f_l (lrint, 0.5L, 0);
+ TEST_f_l (lrint, -0.5L, -1);
+ TEST_f_l (lrint, 0.8L, 0);
+ TEST_f_l (lrint, -0.8L, -1);
+
+ TEST_f_l (lrint, 1.4L, 1);
+ TEST_f_l (lrint, -1.4L, -2);
+
+ TEST_f_l (lrint, 8388600.3L, 8388600);
+ TEST_f_l (lrint, -8388600.3L, -8388601);
+
+ TEST_f_l (lrint, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+ TEST_f_l (lrint, 1073741824.01, 1073741824);
+# if LONG_MAX > 281474976710656
+ TEST_f_l (lrint, 281474976710656.025, 281474976710656);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (lrint_downward);
+}
+
+
+static void
+lrint_test_upward (void)
+{
+ int save_round_mode;
+ START (lrint_upward);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_UPWARD))
+ {
+ TEST_f_l (lrint, 0.0, 0);
+ TEST_f_l (lrint, minus_zero, 0);
+ TEST_f_l (lrint, 0.2L, 1);
+ TEST_f_l (lrint, -0.2L, 0);
+ TEST_f_l (lrint, 0.5L, 1);
+ TEST_f_l (lrint, -0.5L, 0);
+ TEST_f_l (lrint, 0.8L, 1);
+ TEST_f_l (lrint, -0.8L, 0);
+
+ TEST_f_l (lrint, 1.4L, 2);
+ TEST_f_l (lrint, -1.4L, -1);
+
+ TEST_f_l (lrint, 8388600.3L, 8388601);
+ TEST_f_l (lrint, -8388600.3L, -8388600);
+
+#ifndef TEST_FLOAT
+ TEST_f_l (lrint, 1071930.0008, 1071931);
+ TEST_f_l (lrint, 1073741824.01, 1073741825);
+# if LONG_MAX > 281474976710656 && defined (TEST_LDOUBLE)
+ TEST_f_l (lrint, 281474976710656.025, 281474976710656);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (lrint_upward);
+}
+
+
+static void
llrint_test (void)
{
/* XXX this test is incomplete. We need to have a way to specifiy
@@ -3160,10 +3477,639 @@ llrint_test (void)
TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
/* 0x100000000000000 */
TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
+
+ TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
+
+ TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
+#endif
+
+ TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
+
+ TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
+ TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
+
+ TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
+ TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
+#endif
+
+ TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
+ TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
+
+ TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
+ TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
+ TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
+ TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
+ TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
+ TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
+# endif
+#endif
END (llrint);
}
+static void
+llrint_test_tonearest (void)
+{
+ int save_round_mode;
+ START (llrint_tonearest);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_TONEAREST))
+ {
+ TEST_f_L (llrint, 0.0, 0);
+ TEST_f_L (llrint, minus_zero, 0);
+ TEST_f_L (llrint, 0.2L, 0);
+ TEST_f_L (llrint, -0.2L, 0);
+
+ TEST_f_L (llrint, 1.4L, 1);
+ TEST_f_L (llrint, -1.4L, -1);
+
+ TEST_f_L (llrint, 8388600.3L, 8388600);
+ TEST_f_L (llrint, -8388600.3L, -8388600);
+
+ TEST_f_l (llrint, 1071930.0008, 1071930);
+
+ /* Test boundary conditions. */
+ /* 0x1FFFFF */
+ TEST_f_L (llrint, 2097151.0,2097151LL);
+ /* 0x800000 */
+ TEST_f_L (llrint, 8388608.0, 8388608LL);
+ /* 0x1000000 */
+ TEST_f_L (llrint, 16777216.0, 16777216LL);
+ /* 0x20000000000 */
+ TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
+ /* 0x40000000000 */
+ TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
+ /* 0x1000000000000 */
+ TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
+ /* 0x10000000000000 */
+ TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
+ /* 0x10000080000000 */
+ TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+ /* 0x20000000000000 */
+ TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
+ /* 0x80000000000000 */
+ TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
+ /* 0x100000000000000 */
+ TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
+
+ TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
+
+ TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
+#endif
+
+ TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
+
+ TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
+ TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
+
+ TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
+ TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
+#endif
+
+ TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
+ TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
+
+ TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
+ TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
+ TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
+ TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
+ TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
+ TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (llrint_tonearest);
+}
+
+static void
+llrint_test_towardzero (void)
+{
+ int save_round_mode;
+ START (llrint_towardzero);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_TOWARDZERO))
+ {
+ TEST_f_L (llrint, 0.0, 0);
+ TEST_f_L (llrint, minus_zero, 0);
+ TEST_f_L (llrint, 0.2L, 0);
+ TEST_f_L (llrint, -0.2L, 0);
+
+ TEST_f_L (llrint, 1.4L, 1);
+ TEST_f_L (llrint, -1.4L, -1);
+
+ TEST_f_L (llrint, 8388600.3L, 8388600);
+ TEST_f_L (llrint, -8388600.3L, -8388600);
+
+ TEST_f_l (llrint, 1071930.0008, 1071930);
+
+ /* Test boundary conditions. */
+ /* 0x1FFFFF */
+ TEST_f_L (llrint, 2097151.0,2097151LL);
+ /* 0x800000 */
+ TEST_f_L (llrint, 8388608.0, 8388608LL);
+ /* 0x1000000 */
+ TEST_f_L (llrint, 16777216.0, 16777216LL);
+ /* 0x20000000000 */
+ TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
+ /* 0x40000000000 */
+ TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
+ /* 0x1000000000000 */
+ TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
+ /* 0x10000000000000 */
+ TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
+ /* 0x10000080000000 */
+ TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+ /* 0x20000000000000 */
+ TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
+ /* 0x80000000000000 */
+ TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
+ /* 0x100000000000000 */
+ TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
+
+ TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
+ TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
+
+ TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
+ TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
+#endif
+
+ TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
+ TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
+
+ TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
+ TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
+ TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
+ TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
+
+ TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
+ TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
+ TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
+#endif
+
+ TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
+ TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
+
+ TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
+ TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
+ TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
+ TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
+ TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
+ TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (llrint_towardzero);
+}
+
+static void
+llrint_test_downward (void)
+{
+ int save_round_mode;
+ START (llrint_downward);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_DOWNWARD))
+ {
+ TEST_f_L (llrint, 0.0, 0);
+ TEST_f_L (llrint, minus_zero, 0);
+ TEST_f_L (llrint, 0.2L, 0);
+ TEST_f_L (llrint, -0.2L, -1);
+
+ TEST_f_L (llrint, 1.4L, 1);
+ TEST_f_L (llrint, -1.4L, -2);
+
+ TEST_f_L (llrint, 8388600.3L, 8388600);
+ TEST_f_L (llrint, -8388600.3L, -8388601);
+
+ TEST_f_l (llrint, 1071930.0008, 1071930);
+
+ /* Test boundary conditions. */
+ /* 0x1FFFFF */
+ TEST_f_L (llrint, 2097151.0,2097151LL);
+ /* 0x800000 */
+ TEST_f_L (llrint, 8388608.0, 8388608LL);
+ /* 0x1000000 */
+ TEST_f_L (llrint, 16777216.0, 16777216LL);
+ /* 0x20000000000 */
+ TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
+ /* 0x40000000000 */
+ TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
+ /* 0x1000000000000 */
+ TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
+ /* 0x10000000000000 */
+ TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
+ /* 0x10000080000000 */
+ TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+ /* 0x20000000000000 */
+ TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
+ /* 0x80000000000000 */
+ TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
+ /* 0x100000000000000 */
+ TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL);
+
+ TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL);
+ TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL);
+
+ TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.25L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370496.5L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
+
+ TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370498LL);
+ TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL);
+
+ TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL);
+ TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL);
+
+ TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL);
+ TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL);
+ TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL);
+
+ TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.25L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740992.5L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
+
+ TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740994LL);
+ TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL);
+
+ TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL);
+ TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL);
+
+ TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.25L, -72057594037927937LL);
+ TEST_f_L (llrint, -72057594037927936.5L, -72057594037927937LL);
+ TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
+ TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL);
+ TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775807LL);
+ TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L);
+ TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775807LL);
+ TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL);
+ TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
+ TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (llrint_downward);
+}
+
+static void
+llrint_test_upward (void)
+{
+ int save_round_mode;
+ START (llrint_upward);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_UPWARD))
+ {
+ TEST_f_L (llrint, 0.0, 0);
+ TEST_f_L (llrint, minus_zero, 0);
+ TEST_f_L (llrint, 0.2L, 1);
+ TEST_f_L (llrint, -0.2L, 0);
+
+ TEST_f_L (llrint, 1.4L, 2);
+ TEST_f_L (llrint, -1.4L, -1);
+
+ TEST_f_L (llrint, 8388600.3L, 8388601);
+ TEST_f_L (llrint, -8388600.3L, -8388600);
+#ifndef TEST_FLOAT
+ TEST_f_l (llrint, 1071930.0008, 1071931);
+#endif
+ /* Test boundary conditions. */
+ /* 0x1FFFFF */
+ TEST_f_L (llrint, 2097151.0,2097151LL);
+ /* 0x800000 */
+ TEST_f_L (llrint, 8388608.0, 8388608LL);
+ /* 0x1000000 */
+ TEST_f_L (llrint, 16777216.0, 16777216LL);
+ /* 0x20000000000 */
+ TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
+ /* 0x40000000000 */
+ TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
+ /* 0x1000000000000 */
+ TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
+ /* 0x10000000000000 */
+ TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
+ /* 0x10000080000000 */
+ TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+ /* 0x20000000000000 */
+ TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
+ /* 0x80000000000000 */
+ TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
+ /* 0x100000000000000 */
+ TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.25L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370496.5L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
+
+ TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370498LL);
+ TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL);
+ TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL);
+
+ TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL);
+
+ TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL);
+ TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL);
+ TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL);
+
+ TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.25L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740992.5L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
+
+ TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740994LL);
+ TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL);
+
+ TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL);
+ TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL);
+
+ TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL);
+ TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL);
+ TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL);
+
+ TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.25L, 72057594037927937LL);
+ TEST_f_L (llrint, 72057594037927936.5L, 72057594037927937LL);
+ TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
+ TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
+
+ TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL);
+ TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL);
+ TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL);
+ TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775807LL);
+ TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775807L);
+ TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL);
+ TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL);
+ TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL);
+ TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (llrint_upward);
+}
+
static void
log_test (void)
@@ -3181,7 +4127,9 @@ log_test (void)
TEST_f_f (log, 1, 0);
TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (log, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_f_f (log, plus_infty, plus_infty);
+ TEST_f_f (log, nan_value, nan_value);
TEST_f_f (log, M_El, 1);
TEST_f_f (log, 1.0 / M_El, -1);
@@ -3211,6 +4159,7 @@ log10_test (void)
/* log10 (x) == NaN plus invalid exception if x < 0. */
TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (log10, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_f_f (log10, plus_infty, plus_infty);
TEST_f_f (log10, nan_value, nan_value);
@@ -3242,6 +4191,7 @@ log1p_test (void)
TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (log1p, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_f_f (log1p, plus_infty, plus_infty);
TEST_f_f (log1p, nan_value, nan_value);
@@ -3272,6 +4222,7 @@ log2_test (void)
TEST_f_f (log2, 1, 0);
TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (log2, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_f_f (log2, plus_infty, plus_infty);
TEST_f_f (log2, nan_value, nan_value);
@@ -3394,6 +4345,84 @@ llround_test (void)
TEST_f_L (llround, 8589934591.5, 8589934592LL);
#endif
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL);
+ TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL);
+ TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
+ TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llround, 4503599627370495.4999999999999L, 4503599627370495LL);
+ TEST_f_L (llround, 4503599627370496.4999999999999L, 4503599627370496LL);
+ TEST_f_L (llround, 4503599627370497.4999999999999L, 4503599627370497LL);
+ TEST_f_L (llround, 4503599627370494.5000000000001L, 4503599627370495LL);
+ TEST_f_L (llround, 4503599627370495.5000000000001L, 4503599627370496LL);
+ TEST_f_L (llround, 4503599627370496.5000000000001L, 4503599627370497LL);
+
+ TEST_f_L (llround, -4503599627370495.4999999999999L, -4503599627370495LL);
+ TEST_f_L (llround, -4503599627370496.4999999999999L, -4503599627370496LL);
+ TEST_f_L (llround, -4503599627370497.4999999999999L, -4503599627370497LL);
+ TEST_f_L (llround, -4503599627370494.5000000000001L, -4503599627370495LL);
+ TEST_f_L (llround, -4503599627370495.5000000000001L, -4503599627370496LL);
+ TEST_f_L (llround, -4503599627370496.5000000000001L, -4503599627370497LL);
+# endif
+
+ TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
+ TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
+ TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL);
+ TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL);
+
+ TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL);
+ TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL);
+ TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
+ TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_L (llround, 9007199254740991.4999999999999L, 9007199254740991LL);
+ TEST_f_L (llround, 9007199254740992.4999999999999L, 9007199254740992LL);
+ TEST_f_L (llround, 9007199254740993.4999999999999L, 9007199254740993LL);
+ TEST_f_L (llround, 9007199254740991.5000000000001L, 9007199254740992LL);
+ TEST_f_L (llround, 9007199254740992.5000000000001L, 9007199254740993LL);
+ TEST_f_L (llround, 9007199254740993.5000000000001L, 9007199254740994LL);
+
+ TEST_f_L (llround, -9007199254740991.4999999999999L, -9007199254740991LL);
+ TEST_f_L (llround, -9007199254740992.4999999999999L, -9007199254740992LL);
+ TEST_f_L (llround, -9007199254740993.4999999999999L, -9007199254740993LL);
+ TEST_f_L (llround, -9007199254740991.5000000000001L, -9007199254740992LL);
+ TEST_f_L (llround, -9007199254740992.5000000000001L, -9007199254740993LL);
+ TEST_f_L (llround, -9007199254740993.5000000000001L, -9007199254740994LL);
+# endif
+
+ TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
+ TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
+ TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL);
+ TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL);
+
+ TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL);
+ TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL);
+ TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL);
+ TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL);
+
+ TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL);
+ TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL);
+ TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL);
+ TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL);
+
+ TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL);
+ TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL);
+ TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL);
+ TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL);
+ TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL);
+ TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL);
+#endif
+
END (llround);
}
@@ -3590,6 +4619,17 @@ pow_test (void)
/* pow (x, NaN) == NaN. */
TEST_ff_f (pow, 3.0, nan_value, nan_value);
+ TEST_ff_f (pow, minus_zero, nan_value, nan_value);
+ TEST_ff_f (pow, plus_infty, nan_value, nan_value);
+ TEST_ff_f (pow, -3.0, nan_value, nan_value);
+ TEST_ff_f (pow, minus_infty, nan_value, nan_value);
+
+ TEST_ff_f (pow, nan_value, 3.0, nan_value);
+ TEST_ff_f (pow, nan_value, -3.0, nan_value);
+ TEST_ff_f (pow, nan_value, plus_infty, nan_value);
+ TEST_ff_f (pow, nan_value, minus_infty, nan_value);
+ TEST_ff_f (pow, nan_value, 2.5, nan_value);
+ TEST_ff_f (pow, nan_value, -2.5, nan_value);
TEST_ff_f (pow, 1, plus_infty, 1);
TEST_ff_f (pow, -1, plus_infty, 1);
@@ -3790,11 +4830,367 @@ rint_test (void)
TEST_f_f (rint, -2.5, -2.0);
TEST_f_f (rint, -3.5, -4.0);
TEST_f_f (rint, -4.5, -4.0);
+ TEST_f_f (rint, 0.1, 0.0);
+ TEST_f_f (rint, 0.25, 0.0);
+ TEST_f_f (rint, 0.625, 1.0);
+ TEST_f_f (rint, -0.1, -0.0);
+ TEST_f_f (rint, -0.25, -0.0);
+ TEST_f_f (rint, -0.625, -1.0);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
+ TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
+# endif
+
+ TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
+ TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
+
+ TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
+ TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
+
+ TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
+ TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
+# endif
+
+ TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
END (rint);
}
static void
+rint_test_tonearest (void)
+{
+ int save_round_mode;
+ START (rint_tonearest);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_TONEAREST))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 2.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 0.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -0.0);
+ TEST_f_f (rint, -1.0, -1.0);
+ TEST_f_f (rint, -1.5, -2.0);
+ TEST_f_f (rint, -2.0, -2.0);
+ TEST_f_f (rint, 0.1, 0.0);
+ TEST_f_f (rint, 0.25, 0.0);
+ TEST_f_f (rint, 0.625, 1.0);
+ TEST_f_f (rint, -0.1, -0.0);
+ TEST_f_f (rint, -0.25, -0.0);
+ TEST_f_f (rint, -0.625, -1.0);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
+ TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
+# endif
+ TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
+ TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
+
+ TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
+ TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
+
+ TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
+ TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (rint_tonearest);
+}
+
+static void
+rint_test_towardzero (void)
+{
+ int save_round_mode;
+ START (rint_towardzero);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_TOWARDZERO))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 1.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 0.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -0.0);
+ TEST_f_f (rint, -1.0, -1.0);
+ TEST_f_f (rint, -1.5, -1.0);
+ TEST_f_f (rint, -2.0, -2.0);
+ TEST_f_f (rint, 0.1, 0.0);
+ TEST_f_f (rint, 0.25, 0.0);
+ TEST_f_f (rint, 0.625, 0.0);
+ TEST_f_f (rint, -0.1, -0.0);
+ TEST_f_f (rint, -0.25, -0.0);
+ TEST_f_f (rint, -0.625, -0.0);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
+ TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
+ TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
+# endif
+ TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
+ TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
+ TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
+
+ TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
+ TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
+ TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
+
+ TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
+ TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
+ TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (rint_towardzero);
+}
+
+static void
+rint_test_downward (void)
+{
+ int save_round_mode;
+ START (rint_downward);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_DOWNWARD))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 1.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 0.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -1.0);
+ TEST_f_f (rint, -1.0, -1.0);
+ TEST_f_f (rint, -1.5, -2.0);
+ TEST_f_f (rint, -2.0, -2.0);
+ TEST_f_f (rint, 0.1, 0.0);
+ TEST_f_f (rint, 0.25, 0.0);
+ TEST_f_f (rint, 0.625, 0.0);
+ TEST_f_f (rint, -0.1, -1.0);
+ TEST_f_f (rint, -0.25, -1.0);
+ TEST_f_f (rint, -0.625, -1.0);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L);
+ TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L);
+ TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L);
+# endif
+ TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.25L, -4503599627370497.0L);
+ TEST_f_f (rint, -4503599627370496.5L, -4503599627370497.0L);
+ TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
+ TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L);
+
+ TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L);
+ TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L);
+ TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L);
+
+ TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740994.0L);
+ TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (rint_downward);
+}
+
+static void
+rint_test_upward (void)
+{
+ int save_round_mode;
+ START (rint_upward);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_UPWARD))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 2.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 1.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -0.0);
+ TEST_f_f (rint, -1.0, -1.0);
+ TEST_f_f (rint, -1.5, -1.0);
+ TEST_f_f (rint, -2.0, -2.0);
+ TEST_f_f (rint, 0.1, 1.0);
+ TEST_f_f (rint, 0.25, 1.0);
+ TEST_f_f (rint, 0.625, 1.0);
+ TEST_f_f (rint, -0.1, -0.0);
+ TEST_f_f (rint, -0.25, -0.0);
+ TEST_f_f (rint, -0.625, -0.0);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.25L, 4503599627370497.0L);
+ TEST_f_f (rint, 4503599627370496.5L, 4503599627370497.0L);
+ TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
+ TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L);
+# endif
+ TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L);
+ TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L);
+ TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L);
+
+ TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740994.0L);
+ TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L);
+
+ TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L);
+ TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L);
+ TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (rint_upward);
+}
+
+static void
round_test (void)
{
START (round);
@@ -3809,9 +5205,86 @@ round_test (void)
TEST_f_f (round, -0.8L, -1.0);
TEST_f_f (round, 1.5, 2.0);
TEST_f_f (round, -1.5, -2.0);
+ TEST_f_f (round, 0.1, 0.0);
+ TEST_f_f (round, 0.25, 0.0);
+ TEST_f_f (round, 0.625, 1.0);
+ TEST_f_f (round, -0.1, -0.0);
+ TEST_f_f (round, -0.25, -0.0);
+ TEST_f_f (round, -0.625, -1.0);
TEST_f_f (round, 2097152.5, 2097153);
TEST_f_f (round, -2097152.5, -2097153);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
+ TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (round, 4503599627370494.5000000000001L, 4503599627370495.0L);
+ TEST_f_f (round, 4503599627370495.5000000000001L, 4503599627370496.0L);
+ TEST_f_f (round, 4503599627370496.5000000000001L, 4503599627370497.0L);
+# endif
+
+ TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
+ TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (round, -4503599627370494.5000000000001L, -4503599627370495.0L);
+ TEST_f_f (round, -4503599627370495.5000000000001L, -4503599627370496.0L);
+ TEST_f_f (round, -4503599627370496.5000000000001L, -4503599627370497.0L);
+# endif
+
+ TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
+ TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (round, 9007199254740991.0000000000001L, 9007199254740991.0L);
+ TEST_f_f (round, 9007199254740992.0000000000001L, 9007199254740992.0L);
+ TEST_f_f (round, 9007199254740993.0000000000001L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740991.5000000000001L, 9007199254740992.0L);
+ TEST_f_f (round, 9007199254740992.5000000000001L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740993.5000000000001L, 9007199254740994.0L);
+
+ TEST_f_f (round, -9007199254740991.0000000000001L, -9007199254740991.0L);
+ TEST_f_f (round, -9007199254740992.0000000000001L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740993.0000000000001L, -9007199254740993.0L);
+ TEST_f_f (round, -9007199254740991.5000000000001L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.5000000000001L, -9007199254740993.0L);
+ TEST_f_f (round, -9007199254740993.5000000000001L, -9007199254740994.0L);
+# endif
+
+ TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L);
+ TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
+ TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
+
END (round);
}
@@ -4163,7 +5636,11 @@ trunc_test (void)
TEST_f_f (trunc, 0, 0);
TEST_f_f (trunc, minus_zero, minus_zero);
+ TEST_f_f (trunc, 0.1, 0);
+ TEST_f_f (trunc, 0.25, 0);
TEST_f_f (trunc, 0.625, 0);
+ TEST_f_f (trunc, -0.1, minus_zero);
+ TEST_f_f (trunc, -0.25, minus_zero);
TEST_f_f (trunc, -0.625, minus_zero);
TEST_f_f (trunc, 1, 1);
TEST_f_f (trunc, -1, -1);
@@ -4179,6 +5656,80 @@ trunc_test (void)
TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (trunc, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (trunc, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (trunc, 4503599627370494.5000000000001L, 4503599627370494.0L);
+ TEST_f_f (trunc, 4503599627370495.5000000000001L, 4503599627370495.0L);
+ TEST_f_f (trunc, 4503599627370496.5000000000001L, 4503599627370496.0L);
+# endif
+
+ TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (trunc, -4503599627370494.5000000000001L, -4503599627370494.0L);
+ TEST_f_f (trunc, -4503599627370495.5000000000001L, -4503599627370495.0L);
+ TEST_f_f (trunc, -4503599627370496.5000000000001L, -4503599627370496.0L);
+# endif
+
+ TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L);
+ TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (trunc, 9007199254740991.0000000000001L, 9007199254740991.0L);
+ TEST_f_f (trunc, 9007199254740992.0000000000001L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740993.0000000000001L, 9007199254740993.0L);
+ TEST_f_f (trunc, 9007199254740991.5000000000001L, 9007199254740991.0L);
+ TEST_f_f (trunc, 9007199254740992.5000000000001L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740993.5000000000001L, 9007199254740993.0L);
+# endif
+
+ TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L);
+ TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L);
+
+# if LDBL_MANT_DIG > 100
+ TEST_f_f (trunc, -9007199254740991.0000000000001L, -9007199254740991.0L);
+ TEST_f_f (trunc, -9007199254740992.0000000000001L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740993.0000000000001L, -9007199254740993.0L);
+ TEST_f_f (trunc, -9007199254740991.5000000000001L, -9007199254740991.0L);
+ TEST_f_f (trunc, -9007199254740992.5000000000001L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740993.5000000000001L, -9007199254740993.0L);
+# endif
+
+ TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L);
+ TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
+
+ TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
+ TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
+
+ TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
END (trunc);
}
@@ -4557,8 +6108,20 @@ main (int argc, char **argv)
floor_test ();
nearbyint_test ();
rint_test ();
+ rint_test_tonearest ();
+ rint_test_towardzero ();
+ rint_test_downward ();
+ rint_test_upward ();
lrint_test ();
+ lrint_test_tonearest ();
+ lrint_test_towardzero ();
+ lrint_test_downward ();
+ lrint_test_upward ();
llrint_test ();
+ llrint_test_tonearest ();
+ llrint_test_towardzero ();
+ llrint_test_downward ();
+ llrint_test_upward ();
round_test ();
lround_test ();
llround_test ();
diff --git a/math/math.h b/math/math.h
index 7f8a4815f4..c50b2e7b07 100644
--- a/math/math.h
+++ b/math/math.h
@@ -1,5 +1,6 @@
/* Declarations for math functions.
- Copyright (C) 1991-1993,1995-1999,2001,2002,2004 Free Software Foundation, Inc.
+ Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006
+ 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
@@ -96,10 +97,36 @@ __BEGIN_DECLS
# undef _Mdouble_END_NAMESPACE
# undef __MATH_PRECNAME
-# if (__STDC__ - 0 || __GNUC__ - 0) && !defined __NO_LONG_DOUBLE_MATH
+# if (__STDC__ - 0 || __GNUC__ - 0) \
+ && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
+# ifdef __LDBL_COMPAT
+
+# ifdef __USE_ISOC99
+extern float __nldbl_nexttowardf (float __x, long double __y)
+ __THROW __attribute__ ((__const__));
+# ifdef __REDIRECT_NTH
+extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y),
+ __nldbl_nexttowardf)
+ __attribute__ ((__const__));
+extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
+ nextafter) __attribute__ ((__const__));
+extern long double __REDIRECT_NTH (nexttowardl,
+ (long double __x, long double __y),
+ nextafter) __attribute__ ((__const__));
+# endif
+# endif
+
/* Include the file of declarations again, this time using `long double'
instead of `double' and appending l to each function name. */
+# undef __MATHDECL_1
+# define __MATHDECL_2(type, function,suffix, args, alias) \
+ extern type __REDIRECT_NTH(__MATH_PRECNAME(function,suffix), \
+ args, alias)
+# define __MATHDECL_1(type, function,suffix, args) \
+ __MATHDECL_2(type, function,suffix, args, __CONCAT(function,suffix))
+# endif
+
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
diff --git a/math/math_private.h b/math/math_private.h
index f545841df0..129646f8c5 100644
--- a/math/math_private.h
+++ b/math/math_private.h
@@ -11,7 +11,6 @@
/*
* from: @(#)fdlibm.h 5.1 93/09/24
- * $Id$
*/
#ifndef _MATH_PRIVATE_H_
@@ -192,6 +191,10 @@ extern int __kernel_rem_pio2 (double*,double*,int,int,int, const int32_t*);
/* internal functions. */
extern double __copysign (double x, double __y);
+#if __GNUC_PREREQ (4, 0)
+extern inline double __copysign (double x, double y)
+{ return __builtin_copysign (x, y); }
+#endif
/* ieee style elementary float functions */
extern float __ieee754_sqrtf (float);
@@ -235,6 +238,10 @@ extern int __kernel_rem_pio2f (float*,float*,int,int,int, const int32_t*);
/* internal functions. */
extern float __copysignf (float x, float __y);
+#if __GNUC_PREREQ (4, 0)
+extern inline float __copysignf (float x, float y)
+{ return __builtin_copysignf (x, y); }
+#endif
/* ieee style elementary long double functions */
extern long double __ieee754_sqrtl (long double);
@@ -298,6 +305,12 @@ extern long double fabsl (long double x);
extern void __sincosl (long double, long double *, long double *);
extern long double __logbl (long double x);
extern long double __significandl (long double x);
+
+#if __GNUC_PREREQ (4, 0)
+extern inline long double __copysignl (long double x, long double y)
+{ return __builtin_copysignl (x, y); }
+#endif
+
#endif
/* Prototypes for functions of the IBM Accurate Mathematical Library. */
@@ -319,4 +332,10 @@ extern double __slowexp (double __x);
extern double __slowpow (double __x, double __y, double __z);
extern void __docos (double __x, double __dx, double __v[]);
+#ifndef math_opt_barrier
+#define math_opt_barrier(x) \
+({ __typeof (x) __x = x; __asm ("" : "+m" (__x)); __x; })
+#define math_force_eval(x) __asm __volatile ("" : : "m" (x))
+#endif
+
#endif /* _MATH_PRIVATE_H_ */
diff --git a/math/multc3.c b/math/multc3.c
new file mode 100644
index 0000000000..6369f48f24
--- /dev/null
+++ b/math/multc3.c
@@ -0,0 +1,80 @@
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson <rth@redhat.com>, 2005.
+
+ 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 <stdbool.h>
+#include <math.h>
+#include <complex.h>
+
+attribute_hidden
+long double _Complex
+__multc3 (long double a, long double b, long double c, long double d)
+{
+ long double ac, bd, ad, bc, x, y;
+
+ ac = a * c;
+ bd = b * d;
+ ad = a * d;
+ bc = b * c;
+
+ x = ac - bd;
+ y = ad + bc;
+
+ if (isnan (x) && isnan (y))
+ {
+ /* Recover infinities that computed as NaN + iNaN. */
+ bool recalc = 0;
+ if (isinf (a) || isinf (b))
+ {
+ /* z is infinite. "Box" the infinity and change NaNs in
+ the other factor to 0. */
+ a = __copysignl (isinf (a) ? 1 : 0, a);
+ b = __copysignl (isinf (b) ? 1 : 0, b);
+ if (isnan (c)) c = __copysignl (0, c);
+ if (isnan (d)) d = __copysignl (0, d);
+ recalc = 1;
+ }
+ if (isinf (c) || isinf (d))
+ {
+ /* w is infinite. "Box" the infinity and change NaNs in
+ the other factor to 0. */
+ c = __copysignl (isinf (c) ? 1 : 0, c);
+ d = __copysignl (isinf (d) ? 1 : 0, d);
+ if (isnan (a)) a = __copysignl (0, a);
+ if (isnan (b)) b = __copysignl (0, b);
+ recalc = 1;
+ }
+ if (!recalc
+ && (isinf (ac) || isinf (bd) || isinf (ad) || isinf (bc)))
+ {
+ /* Recover infinities from overflow by changing NaNs to 0. */
+ if (isnan (a)) a = __copysignl (0, a);
+ if (isnan (b)) b = __copysignl (0, b);
+ if (isnan (c)) c = __copysignl (0, c);
+ if (isnan (d)) d = __copysignl (0, d);
+ recalc = 1;
+ }
+ if (recalc)
+ {
+ x = INFINITY * (a * c - b * d);
+ y = INFINITY * (a * d + b * c);
+ }
+ }
+
+ return x + I * y;
+}
diff --git a/math/s_asinhl.c b/math/s_asinhl.c
new file mode 100644
index 0000000000..1d5cf47a4f
--- /dev/null
+++ b/math/s_asinhl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__asinhl(long double x)
+{
+ fputs ("__asinhl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+weak_alias (__asinhl, asinhl)
+stub_warning (asinhl)
+#include <stub-tag.h>
diff --git a/math/s_atanl.c b/math/s_atanl.c
new file mode 100644
index 0000000000..d9a7eb6f8f
--- /dev/null
+++ b/math/s_atanl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__atanl (long double x)
+{
+ fputs ("__atanl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+weak_alias (__atanl, atanl)
+
+stub_warning (atanl)
+#include <stub-tag.h>
diff --git a/math/s_cacos.c b/math/s_cacos.c
new file mode 100644
index 0000000000..07b6bdcb9c
--- /dev/null
+++ b/math/s_cacos.c
@@ -0,0 +1,41 @@
+/* Return cosine of complex double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+__complex__ double
+__cacos (__complex__ double x)
+{
+ __complex__ double y;
+ __complex__ double res;
+
+ y = __casin (x);
+
+ __real__ res = (double) M_PI_2 - __real__ y;
+ __imag__ res = -__imag__ y;
+
+ return res;
+}
+weak_alias (__cacos, cacos)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cacos, __cacosl)
+weak_alias (__cacos, cacosl)
+#endif
diff --git a/math/s_cacosf.c b/math/s_cacosf.c
new file mode 100644
index 0000000000..265184e38d
--- /dev/null
+++ b/math/s_cacosf.c
@@ -0,0 +1,39 @@
+/* Return cosine of complex float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+__complex__ float
+__cacosf (__complex__ float x)
+{
+ __complex__ float y;
+ __complex__ float res;
+
+ y = __casinf (x);
+
+ __real__ res = (float) M_PI_2 - __real__ y;
+ __imag__ res = -__imag__ y;
+
+ return res;
+}
+#ifndef __cacosf
+weak_alias (__cacosf, cacosf)
+#endif
diff --git a/math/s_cacosh.c b/math/s_cacosh.c
new file mode 100644
index 0000000000..ada7ca5af6
--- /dev/null
+++ b/math/s_cacosh.c
@@ -0,0 +1,95 @@
+/* Return arc hyperbole cosine for double value.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__cacosh (__complex__ double x)
+{
+ __complex__ double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VAL;
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nan ("");
+ else
+ __imag__ res = __copysign ((rcls == FP_INFINITE
+ ? (__real__ x < 0.0
+ ? M_PI - M_PI_4 : M_PI_4)
+ : M_PI_2), __imag__ x);
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VAL;
+
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysign (signbit (__real__ x) ? M_PI : 0.0,
+ __imag__ x);
+ else
+ __imag__ res = __nan ("");
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysign (M_PI_2, __imag__ x);
+ }
+ else
+ {
+ __complex__ double y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrt (y);
+
+ if (__real__ x < 0.0)
+ y = -y;
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clog (y);
+
+ /* We have to use the positive branch. */
+ if (__real__ res < 0.0)
+ res = -res;
+ }
+
+ return res;
+}
+weak_alias (__cacosh, cacosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cacosh, __cacoshl)
+weak_alias (__cacosh, cacoshl)
+#endif
diff --git a/math/s_cacoshf.c b/math/s_cacoshf.c
new file mode 100644
index 0000000000..a062ffc6f6
--- /dev/null
+++ b/math/s_cacoshf.c
@@ -0,0 +1,108 @@
+/* Return arc hyperbole cosine for float value.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+__complex__ float
+__cacoshf (__complex__ float x)
+{
+ __complex__ float res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALF;
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nanf ("");
+ else
+ __imag__ res = __copysignf ((rcls == FP_INFINITE
+ ? (__real__ x < 0.0
+ ? M_PI - M_PI_4 : M_PI_4)
+ : M_PI_2), __imag__ x);
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALF;
+
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysignf (signbit (__real__ x) ? M_PI : 0.0,
+ __imag__ x);
+ else
+ __imag__ res = __nanf ("");
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysignf (M_PI_2, __imag__ x);
+ }
+ else
+ {
+#if 1
+ __complex__ float y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrtf (y);
+
+ if (__real__ x < 0.0)
+ y = -y;
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clogf (y);
+#else
+ float re2 = __real__ x * __real__ x;
+ float im2 = __imag__ x * __imag__ x;
+ float sq = re2 - im2 - 1.0;
+ float ro = __ieee754_sqrtf (sq * sq + 4 * re2 * im2);
+ float a = __ieee754_sqrtf ((sq + ro) / 2.0);
+ float b = __ieee754_sqrtf ((-sq + ro) / 2.0);
+
+ __real__ res = 0.5 * __ieee754_logf (re2 + __real__ x * 2 * a
+ + im2 + __imag__ x * 2 * b
+ + ro);
+ __imag__ res = __ieee754_atan2f (__imag__ x + b, __real__ x + a);
+#endif
+
+ /* We have to use the positive branch. */
+ if (__real__ res < 0.0)
+ res = -res;
+ }
+
+ return res;
+}
+#ifndef __cacoshf
+weak_alias (__cacoshf, cacoshf)
+#endif
diff --git a/math/s_cacoshl.c b/math/s_cacoshl.c
new file mode 100644
index 0000000000..da23c8d8aa
--- /dev/null
+++ b/math/s_cacoshl.c
@@ -0,0 +1,91 @@
+/* Return arc hyperbole cosine for long double value.
+ Copyright (C) 1997, 1998, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cacoshl (__complex__ long double x)
+{
+ __complex__ long double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALL;
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nanl ("");
+ else
+ __imag__ res = __copysignl ((rcls == FP_INFINITE
+ ? (__real__ x < 0.0
+ ? M_PIl - M_PI_4l : M_PI_4l)
+ : M_PI_2l), __imag__ x);
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALL;
+
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysignl (signbit (__real__ x) ? M_PIl : 0.0,
+ __imag__ x);
+ else
+ __imag__ res = __nanl ("");
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysignl (M_PI_2l, __imag__ x);
+ }
+ else
+ {
+ __complex__ long double y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrtl (y);
+
+ if (__real__ x < 0.0)
+ y = -y;
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clogl (y);
+
+ /* We have to use the positive branch. */
+ if (__real__ res < 0.0)
+ res = -res;
+ }
+
+ return res;
+}
+weak_alias (__cacoshl, cacoshl)
diff --git a/math/s_cacosl.c b/math/s_cacosl.c
new file mode 100644
index 0000000000..a7ceff891b
--- /dev/null
+++ b/math/s_cacosl.c
@@ -0,0 +1,37 @@
+/* Return cosine of complex long double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+__complex__ long double
+__cacosl (__complex__ long double x)
+{
+ __complex__ long double y;
+ __complex__ long double res;
+
+ y = __casinl (x);
+
+ __real__ res = M_PI_2l - __real__ y;
+ __imag__ res = -__imag__ y;
+
+ return res;
+}
+weak_alias (__cacosl, cacosl)
diff --git a/math/s_casin.c b/math/s_casin.c
new file mode 100644
index 0000000000..2d5b06cf78
--- /dev/null
+++ b/math/s_casin.c
@@ -0,0 +1,66 @@
+/* Return arc sine of complex double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__casin (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (isnan (__real__ x) || isnan (__imag__ x))
+ {
+ if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else if (__isinf (__real__ x) || __isinf (__imag__ x))
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __copysign (HUGE_VAL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else
+ {
+ __complex__ double y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ y = __casinh (y);
+
+ __real__ res = __imag__ y;
+ __imag__ res = -__real__ y;
+ }
+
+ return res;
+}
+weak_alias (__casin, casin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__casin, __casinl)
+weak_alias (__casin, casinl)
+#endif
diff --git a/math/s_casinf.c b/math/s_casinf.c
new file mode 100644
index 0000000000..5278dbbf78
--- /dev/null
+++ b/math/s_casinf.c
@@ -0,0 +1,64 @@
+/* Return arc sine of complex float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__casinf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (isnan (__real__ x) || isnan (__imag__ x))
+ {
+ if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else if (__isinff (__real__ x) || __isinff (__imag__ x))
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else
+ {
+ __complex__ float y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ y = __casinhf (y);
+
+ __real__ res = __imag__ y;
+ __imag__ res = -__real__ y;
+ }
+
+ return res;
+}
+#ifndef __casinf
+weak_alias (__casinf, casinf)
+#endif
diff --git a/math/s_casinh.c b/math/s_casinh.c
new file mode 100644
index 0000000000..a574add70e
--- /dev/null
+++ b/math/s_casinh.c
@@ -0,0 +1,84 @@
+/* Return arc hyperbole sine for double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__casinh (__complex__ double x)
+{
+ __complex__ double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysign (HUGE_VAL, __real__ x);
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nan ("");
+ else
+ __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
+ __imag__ x);
+ }
+ else if (rcls <= FP_INFINITE)
+ {
+ __real__ res = __real__ x;
+ if ((rcls == FP_INFINITE && icls >= FP_ZERO)
+ || (rcls == FP_NAN && icls == FP_ZERO))
+ __imag__ res = __copysign (0.0, __imag__ x);
+ else
+ __imag__ res = __nan ("");
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ __complex__ double y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrt (y);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clog (y);
+ }
+
+ return res;
+}
+weak_alias (__casinh, casinh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__casinh, __casinhl)
+weak_alias (__casinh, casinhl)
+#endif
diff --git a/math/s_casinhf.c b/math/s_casinhf.c
new file mode 100644
index 0000000000..7037ab937c
--- /dev/null
+++ b/math/s_casinhf.c
@@ -0,0 +1,82 @@
+/* Return arc hyperbole sine for float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__casinhf (__complex__ float x)
+{
+ __complex__ float res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysignf (HUGE_VALF, __real__ x);
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nanf ("");
+ else
+ __imag__ res = __copysignf (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
+ __imag__ x);
+ }
+ else if (rcls <= FP_INFINITE)
+ {
+ __real__ res = __real__ x;
+ if ((rcls == FP_INFINITE && icls >= FP_ZERO)
+ || (rcls == FP_NAN && icls == FP_ZERO))
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ else
+ __imag__ res = __nanf ("");
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ __complex__ float y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrtf (y);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clogf (y);
+ }
+
+ return res;
+}
+#ifndef __casinhf
+weak_alias (__casinhf, casinhf)
+#endif
diff --git a/math/s_casinhl.c b/math/s_casinhl.c
new file mode 100644
index 0000000000..376b2347a0
--- /dev/null
+++ b/math/s_casinhl.c
@@ -0,0 +1,80 @@
+/* Return arc hyperbole sine for long double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__casinhl (__complex__ long double x)
+{
+ __complex__ long double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysignl (HUGE_VALL, __real__ x);
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nanl ("");
+ else
+ __imag__ res = __copysignl (rcls >= FP_ZERO ? M_PI_2l : M_PI_4l,
+ __imag__ x);
+ }
+ else if (rcls <= FP_INFINITE)
+ {
+ __real__ res = __real__ x;
+ if ((rcls == FP_INFINITE && icls >= FP_ZERO)
+ || (rcls == FP_NAN && icls == FP_ZERO))
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ else
+ __imag__ res = __nanl ("");
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ __complex__ long double y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrtl (y);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clogl (y);
+ }
+
+ return res;
+}
+weak_alias (__casinhl, casinhl)
diff --git a/math/s_casinl.c b/math/s_casinl.c
new file mode 100644
index 0000000000..f303c05ae6
--- /dev/null
+++ b/math/s_casinl.c
@@ -0,0 +1,62 @@
+/* Return arc sine of complex long double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__casinl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (isnan (__real__ x) || isnan (__imag__ x))
+ {
+ if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else if (__isinfl (__real__ x) || __isinfl (__imag__ x))
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else
+ {
+ __complex__ long double y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ y = __casinhl (y);
+
+ __real__ res = __imag__ y;
+ __imag__ res = -__real__ y;
+ }
+
+ return res;
+}
+weak_alias (__casinl, casinl)
diff --git a/math/s_catan.c b/math/s_catan.c
new file mode 100644
index 0000000000..1d0673ad6a
--- /dev/null
+++ b/math/s_catan.c
@@ -0,0 +1,89 @@
+/* Return arc tangent of complex double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__catan (__complex__ double x)
+{
+ __complex__ double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (rcls == FP_INFINITE)
+ {
+ __real__ res = __copysign (M_PI_2, __real__ x);
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ else if (icls == FP_INFINITE)
+ {
+ if (rcls >= FP_ZERO)
+ __real__ res = __copysign (M_PI_2, __real__ x);
+ else
+ __real__ res = __nan ("");
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ else if (icls == FP_ZERO || icls == FP_INFINITE)
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ double r2, num, den;
+
+ r2 = __real__ x * __real__ x;
+
+ den = 1 - r2 - __imag__ x * __imag__ x;
+
+ __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den);
+
+ num = __imag__ x + 1.0;
+ num = r2 + num * num;
+
+ den = __imag__ x - 1.0;
+ den = r2 + den * den;
+
+ __imag__ res = 0.25 * __ieee754_log (num / den);
+ }
+
+ return res;
+}
+weak_alias (__catan, catan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__catan, __catanl)
+weak_alias (__catan, catanl)
+#endif
diff --git a/math/s_catanf.c b/math/s_catanf.c
new file mode 100644
index 0000000000..25eec2b1b5
--- /dev/null
+++ b/math/s_catanf.c
@@ -0,0 +1,87 @@
+/* Return arc tangent of complex float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__catanf (__complex__ float x)
+{
+ __complex__ float res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (rcls == FP_INFINITE)
+ {
+ __real__ res = __copysignf (M_PI_2, __real__ x);
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ else if (icls == FP_INFINITE)
+ {
+ if (rcls >= FP_ZERO)
+ __real__ res = __copysignf (M_PI_2, __real__ x);
+ else
+ __real__ res = __nanf ("");
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ else if (icls == FP_ZERO || icls == FP_INFINITE)
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ float r2, num, den;
+
+ r2 = __real__ x * __real__ x;
+
+ den = 1 - r2 - __imag__ x * __imag__ x;
+
+ __real__ res = 0.5 * __ieee754_atan2f (2.0 * __real__ x, den);
+
+ num = __imag__ x + 1.0;
+ num = r2 + num * num;
+
+ den = __imag__ x - 1.0;
+ den = r2 + den * den;
+
+ __imag__ res = 0.25 * __ieee754_logf (num / den);
+ }
+
+ return res;
+}
+#ifndef __catanf
+weak_alias (__catanf, catanf)
+#endif
diff --git a/math/s_catanh.c b/math/s_catanh.c
new file mode 100644
index 0000000000..e15c073f96
--- /dev/null
+++ b/math/s_catanh.c
@@ -0,0 +1,84 @@
+/* Return arc hyperbole tangent for double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__catanh (__complex__ double x)
+{
+ __complex__ double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysign (0.0, __real__ x);
+ __imag__ res = __copysign (M_PI_2, __imag__ x);
+ }
+ else if (rcls == FP_INFINITE || rcls == FP_ZERO)
+ {
+ __real__ res = __copysign (0.0, __real__ x);
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysign (M_PI_2, __imag__ x);
+ else
+ __imag__ res = __nan ("");
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ double i2, num, den;
+
+ i2 = __imag__ x * __imag__ x;
+
+ num = 1.0 + __real__ x;
+ num = i2 + num * num;
+
+ den = 1.0 - __real__ x;
+ den = i2 + den * den;
+
+ __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den));
+
+ den = 1 - __real__ x * __real__ x - i2;
+
+ __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den);
+ }
+
+ return res;
+}
+weak_alias (__catanh, catanh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__catanh, __catanhl)
+weak_alias (__catanh, catanhl)
+#endif
diff --git a/math/s_catanhf.c b/math/s_catanhf.c
new file mode 100644
index 0000000000..d2422e6111
--- /dev/null
+++ b/math/s_catanhf.c
@@ -0,0 +1,82 @@
+/* Return arc hyperbole tangent for float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__catanhf (__complex__ float x)
+{
+ __complex__ float res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysignf (0.0, __real__ x);
+ __imag__ res = __copysignf (M_PI_2, __imag__ x);
+ }
+ else if (rcls == FP_INFINITE || rcls == FP_ZERO)
+ {
+ __real__ res = __copysignf (0.0, __real__ x);
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysignf (M_PI_2, __imag__ x);
+ else
+ __imag__ res = __nanf ("");
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ float i2, num, den;
+
+ i2 = __imag__ x * __imag__ x;
+
+ num = 1.0 + __real__ x;
+ num = i2 + num * num;
+
+ den = 1.0 - __real__ x;
+ den = i2 + den * den;
+
+ __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den));
+
+ den = 1 - __real__ x * __real__ x - i2;
+
+ __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den);
+ }
+
+ return res;
+}
+#ifndef __catanhf
+weak_alias (__catanhf, catanhf)
+#endif
diff --git a/math/s_catanhl.c b/math/s_catanhl.c
new file mode 100644
index 0000000000..c3fb0ce5ff
--- /dev/null
+++ b/math/s_catanhl.c
@@ -0,0 +1,80 @@
+/* Return arc hyperbole tangent for long double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__catanhl (__complex__ long double x)
+{
+ __complex__ long double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysignl (0.0, __real__ x);
+ __imag__ res = __copysignl (M_PI_2l, __imag__ x);
+ }
+ else if (rcls == FP_INFINITE || rcls == FP_ZERO)
+ {
+ __real__ res = __copysignl (0.0, __real__ x);
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysignl (M_PI_2l, __imag__ x);
+ else
+ __imag__ res = __nanl ("");
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ long double i2, num, den;
+
+ i2 = __imag__ x * __imag__ x;
+
+ num = 1.0 + __real__ x;
+ num = i2 + num * num;
+
+ den = 1.0 - __real__ x;
+ den = i2 + den * den;
+
+ __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den));
+
+ den = 1 - __real__ x * __real__ x - i2;
+
+ __imag__ res = 0.5 * __ieee754_atan2l (2.0 * __imag__ x, den);
+ }
+
+ return res;
+}
+weak_alias (__catanhl, catanhl)
diff --git a/math/s_catanl.c b/math/s_catanl.c
new file mode 100644
index 0000000000..6cb45e5bee
--- /dev/null
+++ b/math/s_catanl.c
@@ -0,0 +1,85 @@
+/* Return arc tangent of complex long double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__catanl (__complex__ long double x)
+{
+ __complex__ long double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (rcls == FP_INFINITE)
+ {
+ __real__ res = __copysignl (M_PI_2l, __real__ x);
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ else if (icls == FP_INFINITE)
+ {
+ if (rcls >= FP_ZERO)
+ __real__ res = __copysignl (M_PI_2l, __real__ x);
+ else
+ __real__ res = __nanl ("");
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ else if (icls == FP_ZERO || icls == FP_INFINITE)
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ long double r2, num, den;
+
+ r2 = __real__ x * __real__ x;
+
+ den = 1 - r2 - __imag__ x * __imag__ x;
+
+ __real__ res = 0.5 * __ieee754_atan2l (2.0 * __real__ x, den);
+
+ num = __imag__ x + 1.0;
+ num = r2 + num * num;
+
+ den = __imag__ x - 1.0;
+ den = r2 + den * den;
+
+ __imag__ res = 0.25 * __ieee754_logl (num / den);
+ }
+
+ return res;
+}
+weak_alias (__catanl, catanl)
diff --git a/math/s_cbrtl.c b/math/s_cbrtl.c
new file mode 100644
index 0000000000..d668e377af
--- /dev/null
+++ b/math/s_cbrtl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__cbrtl(long double x)
+{
+ fputs ("__cbrtl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+weak_alias (__cbrtl, cbrtl)
+stub_warning (cbrtl)
+#include <stub-tag.h>
diff --git a/math/s_ccos.c b/math/s_ccos.c
new file mode 100644
index 0000000000..1b244d7079
--- /dev/null
+++ b/math/s_ccos.c
@@ -0,0 +1,80 @@
+/* Return cosine of complex double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+
+__complex__ double
+__ccos (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (!isfinite (__real__ x) || __isnan (__imag__ x))
+ {
+ if (__real__ x == 0.0 || __imag__ x == 0.0)
+ {
+ __real__ res = __nan ("");
+ __imag__ res = 0.0;
+
+#ifdef FE_INVALID
+ if (__isinf (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else if (__isinf (__imag__ x))
+ {
+ __real__ res = HUGE_VAL;
+ __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (__isinf (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (isfinite (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __complex__ double y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ res = __ccosh (y);
+ }
+
+ return res;
+}
+weak_alias (__ccos, ccos)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ccos, __ccosl)
+weak_alias (__ccos, ccosl)
+#endif
diff --git a/math/s_ccosf.c b/math/s_ccosf.c
new file mode 100644
index 0000000000..4b154deac5
--- /dev/null
+++ b/math/s_ccosf.c
@@ -0,0 +1,78 @@
+/* Return cosine of complex float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+
+__complex__ float
+__ccosf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (!isfinite (__real__ x) || __isnanf (__imag__ x))
+ {
+ if (__real__ x == 0.0 || __imag__ x == 0.0)
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = 0.0;
+
+#ifdef FE_INVALID
+ if (__isinff (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else if (__isinff (__imag__ x))
+ {
+ __real__ res = HUGE_VALF;
+ __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (__isinff (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (isfinite (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __complex__ float y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ res = __ccoshf (y);
+ }
+
+ return res;
+}
+#ifndef __ccosf
+weak_alias (__ccosf, ccosf)
+#endif
diff --git a/math/s_ccosh.c b/math/s_ccosh.c
new file mode 100644
index 0000000000..f5b29db24b
--- /dev/null
+++ b/math/s_ccosh.c
@@ -0,0 +1,105 @@
+/* Complex cosine hyperbole function for double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__ccosh (__complex__ double x)
+{
+ __complex__ double retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double sinh_val = __ieee754_sinh (__real__ x);
+ double cosh_val = __ieee754_cosh (__real__ x);
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * cosix;
+ __imag__ retval = sinh_val * sinix;
+ }
+ else
+ {
+ __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan ("");
+ __real__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = __imag__ x * __copysign (1.0, __real__ x);
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysign (HUGE_VAL, cosix);
+ __imag__ retval = (__copysign (HUGE_VAL, sinix)
+ * __copysign (1.0, __real__ x));
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nan ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
+ }
+
+ return retval;
+}
+weak_alias (__ccosh, ccosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ccosh, __ccoshl)
+weak_alias (__ccosh, ccoshl)
+#endif
diff --git a/math/s_ccoshf.c b/math/s_ccoshf.c
new file mode 100644
index 0000000000..f400d34f0b
--- /dev/null
+++ b/math/s_ccoshf.c
@@ -0,0 +1,103 @@
+/* Complex cosine hyperbole function for float.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__ccoshf (__complex__ float x)
+{
+ __complex__ float retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float sinh_val = __ieee754_sinhf (__real__ x);
+ float cosh_val = __ieee754_coshf (__real__ x);
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * cosix;
+ __imag__ retval = sinh_val * sinix;
+ }
+ else
+ {
+ __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf ("");
+ __real__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x);
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignf (HUGE_VALF, cosix);
+ __imag__ retval = (__copysignf (HUGE_VALF, sinix)
+ * __copysignf (1.0, __real__ x));
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nanf ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
+ }
+
+ return retval;
+}
+#ifndef __ccoshf
+weak_alias (__ccoshf, ccoshf)
+#endif
diff --git a/math/s_ccoshl.c b/math/s_ccoshl.c
new file mode 100644
index 0000000000..61ffb49ca0
--- /dev/null
+++ b/math/s_ccoshl.c
@@ -0,0 +1,101 @@
+/* Complex cosine hyperbole function for long double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ccoshl (__complex__ long double x)
+{
+ __complex__ long double retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double sinh_val = __ieee754_sinhl (__real__ x);
+ long double cosh_val = __ieee754_coshl (__real__ x);
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * cosix;
+ __imag__ retval = sinh_val * sinix;
+ }
+ else
+ {
+ __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl ("");
+ __real__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = __imag__ x * __copysignl (1.0, __real__ x);
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignl (HUGE_VALL, cosix);
+ __imag__ retval = (__copysignl (HUGE_VALL, sinix)
+ * __copysignl (1.0, __real__ x));
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nanl ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
+ }
+
+ return retval;
+}
+weak_alias (__ccoshl, ccoshl)
diff --git a/math/s_ccosl.c b/math/s_ccosl.c
new file mode 100644
index 0000000000..4ebe2c347d
--- /dev/null
+++ b/math/s_ccosl.c
@@ -0,0 +1,76 @@
+/* Return cosine of complex long double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+
+__complex__ long double
+__ccosl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (!isfinite (__real__ x) || __isnanl (__imag__ x))
+ {
+ if (__real__ x == 0.0 || __imag__ x == 0.0)
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = 0.0;
+
+#ifdef FE_INVALID
+ if (__isinfl (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else if (__isinfl (__imag__ x))
+ {
+ __real__ res = HUGE_VALL;
+ __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (__isinfl (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (isfinite (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __complex__ long double y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ res = __ccoshl (y);
+ }
+
+ return res;
+}
+weak_alias (__ccosl, ccosl)
diff --git a/math/s_cexp.c b/math/s_cexp.c
new file mode 100644
index 0000000000..5a299b7687
--- /dev/null
+++ b/math/s_cexp.c
@@ -0,0 +1,127 @@
+/* Return value of complex exponential function for double complex value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__cexp (__complex__ double x)
+{
+ __complex__ double retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double exp_val = __ieee754_exp (__real__ x);
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ if (isfinite (exp_val))
+ {
+ __real__ retval = exp_val * cosix;
+ __imag__ retval = exp_val * sinix;
+ }
+ else
+ {
+ __real__ retval = __copysign (exp_val, cosix);
+ __imag__ retval = __copysign (exp_val, sinix);
+ }
+ }
+ else
+ {
+ /* If the imaginary part is +-inf or NaN and the real part
+ is not +-inf the result is NaN + iNaN. */
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
+
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = value;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysign (value, cosix);
+ __imag__ retval = __copysign (value, sinix);
+ }
+ }
+ else if (signbit (__real__ x) == 0)
+ {
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = 0.0;
+ __imag__ retval = __copysign (0.0, __imag__ x);
+ }
+ }
+ else
+ {
+ /* If the real part is NaN the result is NaN + iNaN. */
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ if (rcls != FP_NAN || icls != FP_NAN)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+
+ return retval;
+}
+weak_alias (__cexp, cexp)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cexp, __cexpl)
+weak_alias (__cexp, cexpl)
+#endif
diff --git a/math/s_cexpf.c b/math/s_cexpf.c
new file mode 100644
index 0000000000..7b68fc365c
--- /dev/null
+++ b/math/s_cexpf.c
@@ -0,0 +1,125 @@
+/* Return value of complex exponential function for float complex value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__cexpf (__complex__ float x)
+{
+ __complex__ float retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float exp_val = __ieee754_expf (__real__ x);
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ if (isfinite (exp_val))
+ {
+ __real__ retval = exp_val * cosix;
+ __imag__ retval = exp_val * sinix;
+ }
+ else
+ {
+ __real__ retval = __copysignf (exp_val, cosix);
+ __imag__ retval = __copysignf (exp_val, sinix);
+ }
+ }
+ else
+ {
+ /* If the imaginary part is +-inf or NaN and the real part
+ is not +-inf the result is NaN + iNaN. */
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
+
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = value;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignf (value, cosix);
+ __imag__ retval = __copysignf (value, sinix);
+ }
+ }
+ else if (signbit (__real__ x) == 0)
+ {
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = 0.0;
+ __imag__ retval = __copysignf (0.0, __imag__ x);
+ }
+ }
+ else
+ {
+ /* If the real part is NaN the result is NaN + iNaN. */
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ if (rcls != FP_NAN || icls != FP_NAN)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+
+ return retval;
+}
+#ifndef __cexpf
+weak_alias (__cexpf, cexpf)
+#endif
diff --git a/math/s_cexpl.c b/math/s_cexpl.c
new file mode 100644
index 0000000000..cf6bc974a9
--- /dev/null
+++ b/math/s_cexpl.c
@@ -0,0 +1,123 @@
+/* Return value of complex exponential function for long double complex value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__cexpl (__complex__ long double x)
+{
+ __complex__ long double retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double exp_val = __ieee754_expl (__real__ x);
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ if (isfinite (exp_val))
+ {
+ __real__ retval = exp_val * cosix;
+ __imag__ retval = exp_val * sinix;
+ }
+ else
+ {
+ __real__ retval = __copysignl (exp_val, cosix);
+ __imag__ retval = __copysignl (exp_val, sinix);
+ }
+ }
+ else
+ {
+ /* If the imaginary part is +-inf or NaN and the real part
+ is not +-inf the result is NaN + iNaN. */
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
+
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = value;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignl (value, cosix);
+ __imag__ retval = __copysignl (value, sinix);
+ }
+ }
+ else if (signbit (__real__ x) == 0)
+ {
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = 0.0;
+ __imag__ retval = __copysignl (0.0, __imag__ x);
+ }
+ }
+ else
+ {
+ /* If the real part is NaN the result is NaN + iNaN. */
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ if (rcls != FP_NAN || icls != FP_NAN)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+
+ return retval;
+}
+weak_alias (__cexpl, cexpl)
diff --git a/math/s_clog.c b/math/s_clog.c
new file mode 100644
index 0000000000..f796024b47
--- /dev/null
+++ b/math/s_clog.c
@@ -0,0 +1,65 @@
+/* Compute complex natural logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__clog (__complex__ double x)
+{
+ __complex__ double result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysign (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabs (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log (__ieee754_hypot (__real__ x,
+ __imag__ x));
+ __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nan ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VAL;
+ else
+ __real__ result = __nan ("");
+ }
+
+ return result;
+}
+weak_alias (__clog, clog)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__clog, __clogl)
+weak_alias (__clog, clogl)
+#endif
diff --git a/math/s_clog10.c b/math/s_clog10.c
new file mode 100644
index 0000000000..62c2ca724a
--- /dev/null
+++ b/math/s_clog10.c
@@ -0,0 +1,65 @@
+/* Compute complex base 10 logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__clog10 (__complex__ double x)
+{
+ __complex__ double result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysign (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabs (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x,
+ __imag__ x));
+ __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nan ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VAL;
+ else
+ __real__ result = __nan ("");
+ }
+
+ return result;
+}
+weak_alias (__clog10, clog10)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__clog10, __clog10l)
+weak_alias (__clog10, clog10l)
+#endif
diff --git a/math/s_clog10f.c b/math/s_clog10f.c
new file mode 100644
index 0000000000..eed81f368c
--- /dev/null
+++ b/math/s_clog10f.c
@@ -0,0 +1,63 @@
+/* Compute complex base 10 logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__clog10f (__complex__ float x)
+{
+ __complex__ float result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysignf (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsf (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x,
+ __imag__ x));
+ __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nanf ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALF;
+ else
+ __real__ result = __nanf ("");
+ }
+
+ return result;
+}
+#ifndef __clog10f
+weak_alias (__clog10f, clog10f)
+#endif
diff --git a/math/s_clog10l.c b/math/s_clog10l.c
new file mode 100644
index 0000000000..f901543d05
--- /dev/null
+++ b/math/s_clog10l.c
@@ -0,0 +1,61 @@
+/* Compute complex base 10 logarithm.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__clog10l (__complex__ long double x)
+{
+ __complex__ long double result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
+ __imag__ result = __copysignl (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsl (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x,
+ __imag__ x));
+ __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nanl ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALL;
+ else
+ __real__ result = __nanl ("");
+ }
+
+ return result;
+}
+weak_alias (__clog10l, clog10l)
diff --git a/math/s_clogf.c b/math/s_clogf.c
new file mode 100644
index 0000000000..21e3b57b7f
--- /dev/null
+++ b/math/s_clogf.c
@@ -0,0 +1,63 @@
+/* Compute complex natural logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__clogf (__complex__ float x)
+{
+ __complex__ float result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysignf (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsf (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_logf (__ieee754_hypotf (__real__ x,
+ __imag__ x));
+ __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nanf ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALF;
+ else
+ __real__ result = __nanf ("");
+ }
+
+ return result;
+}
+#ifndef __clogf
+weak_alias (__clogf, clogf)
+#endif
diff --git a/math/s_clogl.c b/math/s_clogl.c
new file mode 100644
index 0000000000..43118f768c
--- /dev/null
+++ b/math/s_clogl.c
@@ -0,0 +1,61 @@
+/* Compute complex natural logarithm.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__clogl (__complex__ long double x)
+{
+ __complex__ long double result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
+ __imag__ result = __copysignl (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsl (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_logl (__ieee754_hypotl (__real__ x,
+ __imag__ x));
+ __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nanl ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALL;
+ else
+ __real__ result = __nanl ("");
+ }
+
+ return result;
+}
+weak_alias (__clogl, clogl)
diff --git a/math/s_cpow.c b/math/s_cpow.c
new file mode 100644
index 0000000000..86536cc95b
--- /dev/null
+++ b/math/s_cpow.c
@@ -0,0 +1,34 @@
+/* Complex power of double values.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__cpow (__complex__ double x, __complex__ double c)
+{
+ return __cexp (c * __clog (x));
+}
+weak_alias (__cpow, cpow)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cpow, __cpowl)
+weak_alias (__cpow, cpowl)
+#endif
diff --git a/math/s_cpowf.c b/math/s_cpowf.c
new file mode 100644
index 0000000000..58eaa1aa06
--- /dev/null
+++ b/math/s_cpowf.c
@@ -0,0 +1,32 @@
+/* Complex power of float values.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__cpowf (__complex__ float x, __complex__ float c)
+{
+ return __cexpf (c * __clogf (x));
+}
+#ifndef __cpowf
+weak_alias (__cpowf, cpowf)
+#endif
diff --git a/math/s_cpowl.c b/math/s_cpowl.c
new file mode 100644
index 0000000000..4c358b3ebe
--- /dev/null
+++ b/math/s_cpowl.c
@@ -0,0 +1,30 @@
+/* Complex power of long double values.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cpowl (__complex__ long double x, __complex__ long double c)
+{
+ return __cexpl (c * __clogl (x));
+}
+weak_alias (__cpowl, cpowl)
diff --git a/math/s_cproj.c b/math/s_cproj.c
new file mode 100644
index 0000000000..8e7ca41df8
--- /dev/null
+++ b/math/s_cproj.c
@@ -0,0 +1,51 @@
+/* Compute projection of complex double value to Riemann sphere.
+ Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__cproj (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (isnan (__real__ x) && isnan (__imag__ x))
+ return x;
+ else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ __real__ res = INFINITY;
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ else
+ {
+ double den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0;
+
+ __real__ res = (2.0 * __real__ x) / den;
+ __imag__ res = (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+weak_alias (__cproj, cproj)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cproj, __cprojl)
+weak_alias (__cproj, cprojl)
+#endif
diff --git a/math/s_cprojf.c b/math/s_cprojf.c
new file mode 100644
index 0000000000..83df13cfa9
--- /dev/null
+++ b/math/s_cprojf.c
@@ -0,0 +1,49 @@
+/* Compute projection of complex float value to Riemann sphere.
+ Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__cprojf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (isnan (__real__ x) && isnan (__imag__ x))
+ return x;
+ else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ __real__ res = INFINITY;
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ else
+ {
+ float den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0;
+
+ __real__ res = (2.0 * __real__ x) / den;
+ __imag__ res = (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+#ifndef __cprojf
+weak_alias (__cprojf, cprojf)
+#endif
diff --git a/math/s_cprojl.c b/math/s_cprojl.c
new file mode 100644
index 0000000000..c70cdc47db
--- /dev/null
+++ b/math/s_cprojl.c
@@ -0,0 +1,48 @@
+/* Compute projection of complex long double value to Riemann sphere.
+ Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cprojl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (isnan (__real__ x) && isnan (__imag__ x))
+ return x;
+ else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ __real__ res = INFINITY;
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ else
+ {
+ long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x
+ + 1.0);
+
+ __real__ res = (2.0 * __real__ x) / den;
+ __imag__ res = (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+weak_alias (__cprojl, cprojl)
diff --git a/math/s_csin.c b/math/s_csin.c
new file mode 100644
index 0000000000..eb380e2c3f
--- /dev/null
+++ b/math/s_csin.c
@@ -0,0 +1,131 @@
+/* Complex sine function for double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__csin (__complex__ double x)
+{
+ __complex__ double retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabs (__real__ x);
+
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ double sinh_val = __ieee754_sinh (__imag__ x);
+ double cosh_val = __ieee754_cosh (__imag__ x);
+ double sinix, cosix;
+
+ __sincos (__real__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = __nan ("");
+ __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (icls == FP_INFINITE)
+ {
+ /* Imaginary part is infinite. */
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (rcls > FP_ZERO)
+ {
+ /* Real part is finite. */
+ double sinix, cosix;
+
+ __sincos (__real__ x, &sinix, &cosix);
+
+ __real__ retval = __copysign (HUGE_VAL, sinix);
+ __imag__ retval = __copysign (HUGE_VAL, cosix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = __nan ("");
+ __imag__ retval = HUGE_VAL;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+ }
+
+ return retval;
+}
+weak_alias (__csin, csin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csin, __csinl)
+weak_alias (__csin, csinl)
+#endif
diff --git a/math/s_csinf.c b/math/s_csinf.c
new file mode 100644
index 0000000000..8004743bd3
--- /dev/null
+++ b/math/s_csinf.c
@@ -0,0 +1,129 @@
+/* Complex sine function for float.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__csinf (__complex__ float x)
+{
+ __complex__ float retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabsf (__real__ x);
+
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ float sinh_val = __ieee754_sinhf (__imag__ x);
+ float cosh_val = __ieee754_coshf (__imag__ x);
+ float sinix, cosix;
+
+ __sincosf (__real__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = __nanf ("");
+ __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (icls == FP_INFINITE)
+ {
+ /* Imaginary part is infinite. */
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (rcls > FP_ZERO)
+ {
+ /* Real part is finite. */
+ float sinix, cosix;
+
+ __sincosf (__real__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignf (HUGE_VALF, sinix);
+ __imag__ retval = __copysignf (HUGE_VALF, cosix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = __nanf ("");
+ __imag__ retval = HUGE_VALF;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+ }
+
+ return retval;
+}
+#ifndef __csinf
+weak_alias (__csinf, csinf)
+#endif
diff --git a/math/s_csinh.c b/math/s_csinh.c
new file mode 100644
index 0000000000..f0e0cc61f1
--- /dev/null
+++ b/math/s_csinh.c
@@ -0,0 +1,126 @@
+/* Complex sine hyperbole function for double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__csinh (__complex__ double x)
+{
+ __complex__ double retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabs (__real__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double sinh_val = __ieee754_sinh (__real__ x);
+ double cosh_val = __ieee754_cosh (__real__ x);
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = sinh_val * cosix;
+ __imag__ retval = cosh_val * sinix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
+ __imag__ retval = __imag__ x;
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysign (HUGE_VAL, cosix);
+ __imag__ retval = __copysign (HUGE_VAL, sinix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nan ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
+ }
+
+ return retval;
+}
+weak_alias (__csinh, csinh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csinh, __csinhl)
+weak_alias (__csinh, csinhl)
+#endif
diff --git a/math/s_csinhf.c b/math/s_csinhf.c
new file mode 100644
index 0000000000..e4bb704268
--- /dev/null
+++ b/math/s_csinhf.c
@@ -0,0 +1,124 @@
+/* Complex sine hyperbole function for float.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__csinhf (__complex__ float x)
+{
+ __complex__ float retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabsf (__real__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float sinh_val = __ieee754_sinhf (__real__ x);
+ float cosh_val = __ieee754_coshf (__real__ x);
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = sinh_val * cosix;
+ __imag__ retval = cosh_val * sinix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = negate ? -HUGE_VALF : HUGE_VALF;
+ __imag__ retval = __imag__ x;
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignf (HUGE_VALF, cosix);
+ __imag__ retval = __copysignf (HUGE_VALF, sinix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nanf ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
+ }
+
+ return retval;
+}
+#ifndef __csinhf
+weak_alias (__csinhf, csinhf)
+#endif
diff --git a/math/s_csinhl.c b/math/s_csinhl.c
new file mode 100644
index 0000000000..226075634d
--- /dev/null
+++ b/math/s_csinhl.c
@@ -0,0 +1,122 @@
+/* Complex sine hyperbole function for long double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__csinhl (__complex__ long double x)
+{
+ __complex__ long double retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabsl (__real__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double sinh_val = __ieee754_sinhl (__real__ x);
+ long double cosh_val = __ieee754_coshl (__real__ x);
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = sinh_val * cosix;
+ __imag__ retval = cosh_val * sinix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = negate ? -HUGE_VALL : HUGE_VALL;
+ __imag__ retval = __imag__ x;
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignl (HUGE_VALL, cosix);
+ __imag__ retval = __copysignl (HUGE_VALL, sinix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nanl ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
+ }
+
+ return retval;
+}
+weak_alias (__csinhl, csinhl)
diff --git a/math/s_csinl.c b/math/s_csinl.c
new file mode 100644
index 0000000000..f7a1c43600
--- /dev/null
+++ b/math/s_csinl.c
@@ -0,0 +1,127 @@
+/* Complex sine function for long double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__csinl (__complex__ long double x)
+{
+ __complex__ long double retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabsl (__real__ x);
+
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ long double sinh_val = __ieee754_sinhl (__imag__ x);
+ long double cosh_val = __ieee754_coshl (__imag__ x);
+ long double sinix, cosix;
+
+ __sincosl (__real__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = __nanl ("");
+ __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (icls == FP_INFINITE)
+ {
+ /* Imaginary part is infinite. */
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (rcls > FP_ZERO)
+ {
+ /* Real part is finite. */
+ long double sinix, cosix;
+
+ __sincosl (__real__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignl (HUGE_VALL, sinix);
+ __imag__ retval = __copysignl (HUGE_VALL, cosix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = __nanl ("");
+ __imag__ retval = HUGE_VALL;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+ }
+
+ return retval;
+}
+weak_alias (__csinl, csinl)
diff --git a/math/s_csqrt.c b/math/s_csqrt.c
new file mode 100644
index 0000000000..04ed410a16
--- /dev/null
+++ b/math/s_csqrt.c
@@ -0,0 +1,114 @@
+/* Complex square root of double value.
+ Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__csqrt (__complex__ double x)
+{
+ __complex__ double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VAL;
+ __imag__ res = __imag__ x;
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = icls == FP_NAN ? __nan ("") : 0;
+ __imag__ res = __copysign (HUGE_VAL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __real__ x;
+ __imag__ res = (icls == FP_NAN
+ ? __nan ("") : __copysign (0.0, __imag__ x));
+ }
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysign (__ieee754_sqrt (-__real__ x),
+ __imag__ x);
+ }
+ else
+ {
+ __real__ res = fabs (__ieee754_sqrt (__real__ x));
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ }
+ else if (rcls == FP_ZERO)
+ {
+ double r = __ieee754_sqrt (0.5 * fabs (__imag__ x));
+
+ __real__ res = r;
+ __imag__ res = __copysign (r, __imag__ x);
+ }
+ else
+ {
+ double d, r, s;
+
+ d = __ieee754_hypot (__real__ x, __imag__ x);
+ /* Use the identity 2 Re res Im res = Im x
+ to avoid cancellation error in d +/- Re x. */
+ if (__real__ x > 0)
+ {
+ r = __ieee754_sqrt (0.5 * d + 0.5 * __real__ x);
+ s = (0.5 * __imag__ x) / r;
+ }
+ else
+ {
+ s = __ieee754_sqrt (0.5 * d - 0.5 * __real__ x);
+ r = fabs ((0.5 * __imag__ x) / s);
+ }
+
+ __real__ res = r;
+ __imag__ res = __copysign (s, __imag__ x);
+ }
+ }
+
+ return res;
+}
+weak_alias (__csqrt, csqrt)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csqrt, __csqrtl)
+weak_alias (__csqrt, csqrtl)
+#endif
diff --git a/math/s_csqrtf.c b/math/s_csqrtf.c
new file mode 100644
index 0000000000..2fba69ce1b
--- /dev/null
+++ b/math/s_csqrtf.c
@@ -0,0 +1,112 @@
+/* Complex square root of float value.
+ Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__csqrtf (__complex__ float x)
+{
+ __complex__ float res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALF;
+ __imag__ res = __imag__ x;
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = icls == FP_NAN ? __nanf ("") : 0;
+ __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __real__ x;
+ __imag__ res = (icls == FP_NAN
+ ? __nanf ("") : __copysignf (0.0, __imag__ x));
+ }
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x),
+ __imag__ x);
+ }
+ else
+ {
+ __real__ res = fabsf (__ieee754_sqrtf (__real__ x));
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ }
+ else if (rcls == FP_ZERO)
+ {
+ float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x));
+
+ __real__ res = r;
+ __imag__ res = __copysignf (r, __imag__ x);
+ }
+ else
+ {
+ float d, r, s;
+
+ d = __ieee754_hypotf (__real__ x, __imag__ x);
+ /* Use the identity 2 Re res Im res = Im x
+ to avoid cancellation error in d +/- Re x. */
+ if (__real__ x > 0)
+ {
+ r = __ieee754_sqrtf (0.5f * d + 0.5f * __real__ x);
+ s = (0.5f * __imag__ x) / r;
+ }
+ else
+ {
+ s = __ieee754_sqrtf (0.5f * d - 0.5f * __real__ x);
+ r = fabsf ((0.5f * __imag__ x) / s);
+ }
+
+ __real__ res = r;
+ __imag__ res = __copysignf (s, __imag__ x);
+ }
+ }
+
+ return res;
+}
+#ifndef __csqrtf
+weak_alias (__csqrtf, csqrtf)
+#endif
diff --git a/math/s_csqrtl.c b/math/s_csqrtl.c
new file mode 100644
index 0000000000..9d00946c51
--- /dev/null
+++ b/math/s_csqrtl.c
@@ -0,0 +1,110 @@
+/* Complex square root of long double value.
+ Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__csqrtl (__complex__ long double x)
+{
+ __complex__ long double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALL;
+ __imag__ res = __imag__ x;
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = icls == FP_NAN ? __nanl ("") : 0;
+ __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __real__ x;
+ __imag__ res = (icls == FP_NAN
+ ? __nanl ("") : __copysignl (0.0, __imag__ x));
+ }
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x),
+ __imag__ x);
+ }
+ else
+ {
+ __real__ res = fabsl (__ieee754_sqrtl (__real__ x));
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ }
+ else if (rcls == FP_ZERO)
+ {
+ long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x));
+
+ __real__ res = r;
+ __imag__ res = __copysignl (r, __imag__ x);
+ }
+ else
+ {
+ long double d, r, s;
+
+ d = __ieee754_hypotl (__real__ x, __imag__ x);
+ /* Use the identity 2 Re res Im res = Im x
+ to avoid cancellation error in d +/- Re x. */
+ if (__real__ x > 0)
+ {
+ r = __ieee754_sqrtl (0.5L * d + 0.5L * __real__ x);
+ s = (0.5L * __imag__ x) / r;
+ }
+ else
+ {
+ s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x);
+ r = fabsl ((0.5L * __imag__ x) / s);
+ }
+
+ __real__ res = r;
+ __imag__ res = __copysignl (s, __imag__ x);
+ }
+ }
+
+ return res;
+}
+weak_alias (__csqrtl, csqrtl)
diff --git a/math/s_ctan.c b/math/s_ctan.c
new file mode 100644
index 0000000000..0464ab86d5
--- /dev/null
+++ b/math/s_ctan.c
@@ -0,0 +1,84 @@
+/* Complex tangent function for double.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__ctan (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinf (__imag__ x))
+ {
+ __real__ res = __copysign (0.0, __real__ x);
+ __imag__ res = __copysign (1.0, __imag__ x);
+ }
+ else if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (__isinf (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ double sin2rx, cos2rx;
+ double den;
+
+ __sincos (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+ den = cos2rx + __ieee754_cosh (2.0 * __imag__ x);
+
+ if (den == 0.0)
+ {
+ __complex__ double ez = __cexp (1.0i * x);
+ __complex__ double emz = __cexp (-1.0i * x);
+
+ res = (ez - emz) / (ez + emz) * -1.0i;
+ }
+ else
+ {
+ __real__ res = sin2rx / den;
+ __imag__ res = __ieee754_sinh (2.0 * __imag__ x) / den;
+ }
+ }
+
+ return res;
+}
+weak_alias (__ctan, ctan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ctan, __ctanl)
+weak_alias (__ctan, ctanl)
+#endif
diff --git a/math/s_ctanf.c b/math/s_ctanf.c
new file mode 100644
index 0000000000..58d9d13298
--- /dev/null
+++ b/math/s_ctanf.c
@@ -0,0 +1,83 @@
+/* Complex tangent function for float.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__ctanf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinff (__imag__ x))
+ {
+ __real__ res = __copysignf (0.0, __real__ x);
+ __imag__ res = __copysignf (1.0, __imag__ x);
+ }
+ else if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (__isinff (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ float sin2rx, cos2rx;
+ float den;
+
+ __sincosf (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+ den = cos2rx + __ieee754_coshf (2.0 * __imag__ x);
+
+
+ if (den == 0.0)
+ {
+ __complex__ float ez = __cexpf (1.0i * x);
+ __complex__ float emz = __cexpf (-1.0i * x);
+
+ res = (ez - emz) / (ez + emz) * -1.0i;
+ }
+ else
+ {
+ __real__ res = sin2rx / den;
+ __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den;
+ }
+ }
+
+ return res;
+}
+#ifndef __ctanf
+weak_alias (__ctanf, ctanf)
+#endif
diff --git a/math/s_ctanh.c b/math/s_ctanh.c
new file mode 100644
index 0000000000..fe38dae291
--- /dev/null
+++ b/math/s_ctanh.c
@@ -0,0 +1,84 @@
+/* Complex hyperbole tangent for double.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__ctanh (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinf (__real__ x))
+ {
+ __real__ res = __copysign (1.0, __real__ x);
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ else if (__imag__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (__isinf (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ double sin2ix, cos2ix;
+ double den;
+
+ __sincos (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+ den = (__ieee754_cosh (2.0 * __real__ x) + cos2ix);
+
+ if (den == 0.0)
+ {
+ __complex__ double ez = __cexp (x);
+ __complex__ double emz = __cexp (-x);
+
+ res = (ez - emz) / (ez + emz);
+ }
+ else
+ {
+ __real__ res = __ieee754_sinh (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+ }
+
+ return res;
+}
+weak_alias (__ctanh, ctanh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ctanh, __ctanhl)
+weak_alias (__ctanh, ctanhl)
+#endif
diff --git a/math/s_ctanhf.c b/math/s_ctanhf.c
new file mode 100644
index 0000000000..c331dbaabb
--- /dev/null
+++ b/math/s_ctanhf.c
@@ -0,0 +1,82 @@
+/* Complex hyperbole tangent for float.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__ctanhf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinff (__real__ x))
+ {
+ __real__ res = __copysignf (1.0, __real__ x);
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ else if (__imag__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (__isinff (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ float sin2ix, cos2ix;
+ float den;
+
+ __sincosf (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+ den = (__ieee754_coshf (2.0 * __real__ x) + cos2ix);
+
+ if (den == 0.0f)
+ {
+ __complex__ float ez = __cexpf (x);
+ __complex__ float emz = __cexpf (-x);
+
+ res = (ez - emz) / (ez + emz);
+ }
+ else
+ {
+ __real__ res = __ieee754_sinhf (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+ }
+
+ return res;
+}
+#ifndef __ctanhf
+weak_alias (__ctanhf, ctanhf)
+#endif
diff --git a/math/s_ctanhl.c b/math/s_ctanhl.c
new file mode 100644
index 0000000000..77ca8f8717
--- /dev/null
+++ b/math/s_ctanhl.c
@@ -0,0 +1,80 @@
+/* Complex hyperbole tangent for long double.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ctanhl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinfl (__real__ x))
+ {
+ __real__ res = __copysignl (1.0, __real__ x);
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ else if (__imag__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (__isinfl (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ long double sin2ix, cos2ix;
+ long double den;
+
+ __sincosl (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+ den = (__ieee754_coshl (2.0 * __real__ x) + cos2ix);
+
+ if (den == 0.0L)
+ {
+ __complex__ long double ez = __cexpl (x);
+ __complex__ long double emz = __cexpl (-x);
+
+ res = (ez - emz) / (ez + emz);
+ }
+ else
+ {
+ __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+ }
+
+ return res;
+}
+weak_alias (__ctanhl, ctanhl)
diff --git a/math/s_ctanl.c b/math/s_ctanl.c
new file mode 100644
index 0000000000..89379a5ff9
--- /dev/null
+++ b/math/s_ctanl.c
@@ -0,0 +1,81 @@
+/* Complex tangent function for long double.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ctanl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinfl (__imag__ x))
+ {
+ __real__ res = __copysignl (0.0, __real__ x);
+ __imag__ res = __copysignl (1.0, __imag__ x);
+ }
+ else if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (__isinfl (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ long double sin2rx, cos2rx;
+ long double den;
+
+ __sincosl (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+ den = cos2rx + __ieee754_coshl (2.0 * __imag__ x);
+
+
+ if (den == 0.0)
+ {
+ __complex__ long double ez = __cexpl (1.0i * x);
+ __complex__ long double emz = __cexpl (-1.0i * x);
+
+ res = (ez - emz) / (ez + emz) * -1.0i;
+ }
+ else
+ {
+ __real__ res = sin2rx / den;
+ __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den;
+ }
+ }
+
+ return res;
+}
+weak_alias (__ctanl, ctanl)
diff --git a/math/s_erfl.c b/math/s_erfl.c
new file mode 100644
index 0000000000..f329d58809
--- /dev/null
+++ b/math/s_erfl.c
@@ -0,0 +1,26 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__erfl (long double x)
+{
+ fputs ("__erfl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+weak_alias (__erfl, erfl)
+
+stub_warning (erfl)
+
+long double
+__erfcl (long double x)
+{
+ fputs ("__erfcl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+weak_alias (__erfcl, erfcl)
+
+stub_warning (erfcl)
+#include <stub-tag.h>
diff --git a/math/s_expm1l.c b/math/s_expm1l.c
new file mode 100644
index 0000000000..b69d6aeb97
--- /dev/null
+++ b/math/s_expm1l.c
@@ -0,0 +1,16 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__expm1l (long double x)
+{
+ fputs ("__expm1l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+libm_hidden_def (__expm1l)
+weak_alias (__expm1l, expm1l)
+
+stub_warning (expm1l)
+#include <stub-tag.h>
diff --git a/math/s_fdim.c b/math/s_fdim.c
new file mode 100644
index 0000000000..5804e631c3
--- /dev/null
+++ b/math/s_fdim.c
@@ -0,0 +1,40 @@
+/* Return positive difference between arguments.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+double
+__fdim (double x, double y)
+{
+ int clsx = fpclassify (x);
+ int clsy = fpclassify (y);
+
+ if (clsx == FP_NAN || clsy == FP_NAN
+ || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+ /* Raise invalid flag. */
+ return x - y;
+
+ return x <= y ? 0 : x - y;
+}
+weak_alias (__fdim, fdim)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fdim, __fdiml)
+weak_alias (__fdim, fdiml)
+#endif
diff --git a/math/s_fdimf.c b/math/s_fdimf.c
new file mode 100644
index 0000000000..2f3ce303ae
--- /dev/null
+++ b/math/s_fdimf.c
@@ -0,0 +1,36 @@
+/* Return positive difference between arguments.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+float
+__fdimf (float x, float y)
+{
+ int clsx = fpclassify (x);
+ int clsy = fpclassify (y);
+
+ if (clsx == FP_NAN || clsy == FP_NAN
+ || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+ /* Raise invalid flag. */
+ return x - y;
+
+ return x <= y ? 0 : x - y;
+}
+weak_alias (__fdimf, fdimf)
diff --git a/math/s_fdiml.c b/math/s_fdiml.c
new file mode 100644
index 0000000000..70246bafbd
--- /dev/null
+++ b/math/s_fdiml.c
@@ -0,0 +1,36 @@
+/* Return positive difference between arguments.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+long double
+__fdiml (long double x, long double y)
+{
+ int clsx = fpclassify (x);
+ int clsy = fpclassify (y);
+
+ if (clsx == FP_NAN || clsy == FP_NAN
+ || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+ /* Raise invalid flag. */
+ return x - y;
+
+ return x <= y ? 0 : x - y;
+}
+weak_alias (__fdiml, fdiml)
diff --git a/math/s_fma.c b/math/s_fma.c
new file mode 100644
index 0000000000..e5ff5a7228
--- /dev/null
+++ b/math/s_fma.c
@@ -0,0 +1,33 @@
+/* Compute x * y + z as ternary operation.
+ Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+double
+__fma (double x, double y, double z)
+{
+ return (x * y) + z;
+}
+weak_alias (__fma, fma)
+
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fma, __fmal)
+weak_alias (__fmal, fmal)
+#endif
diff --git a/math/s_fmaf.c b/math/s_fmaf.c
new file mode 100644
index 0000000000..caa7f3afe8
--- /dev/null
+++ b/math/s_fmaf.c
@@ -0,0 +1,28 @@
+/* Compute x * y + z as ternary operation.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+float
+__fmaf (float x, float y, float z)
+{
+ return (x * y) + z;
+}
+weak_alias (__fmaf, fmaf)
diff --git a/math/s_fmal.c b/math/s_fmal.c
new file mode 100644
index 0000000000..b89e88b9a3
--- /dev/null
+++ b/math/s_fmal.c
@@ -0,0 +1,28 @@
+/* Compute x * y + z as ternary operation.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+long double
+__fmal (long double x, long double y, long double z)
+{
+ return (x * y) + z;
+}
+weak_alias (__fmal, fmal)
diff --git a/math/s_fmax.c b/math/s_fmax.c
new file mode 100644
index 0000000000..f93e14f28c
--- /dev/null
+++ b/math/s_fmax.c
@@ -0,0 +1,33 @@
+/* Return maximum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+
+double
+__fmax (double x, double y)
+{
+ return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmax, fmax)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fmax, __fmaxl)
+weak_alias (__fmax, fmaxl)
+#endif
diff --git a/math/s_fmaxf.c b/math/s_fmaxf.c
new file mode 100644
index 0000000000..6f368e18b0
--- /dev/null
+++ b/math/s_fmaxf.c
@@ -0,0 +1,29 @@
+/* Return maximum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+
+float
+__fmaxf (float x, float y)
+{
+ return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmaxf, fmaxf)
diff --git a/math/s_fmaxl.c b/math/s_fmaxl.c
new file mode 100644
index 0000000000..68c7060f42
--- /dev/null
+++ b/math/s_fmaxl.c
@@ -0,0 +1,29 @@
+/* Return maximum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+
+long double
+__fmaxl (long double x, long double y)
+{
+ return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmaxl, fmaxl)
diff --git a/math/s_fmin.c b/math/s_fmin.c
new file mode 100644
index 0000000000..78f02da74a
--- /dev/null
+++ b/math/s_fmin.c
@@ -0,0 +1,33 @@
+/* Return minimum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+
+double
+__fmin (double x, double y)
+{
+ return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmin, fmin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fmin, __fminl)
+weak_alias (__fmin, fminl)
+#endif
diff --git a/math/s_fminf.c b/math/s_fminf.c
new file mode 100644
index 0000000000..d6aa9ccf62
--- /dev/null
+++ b/math/s_fminf.c
@@ -0,0 +1,29 @@
+/* Return minimum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+
+float
+__fminf (float x, float y)
+{
+ return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fminf, fminf)
diff --git a/math/s_fminl.c b/math/s_fminl.c
new file mode 100644
index 0000000000..5c1610aa85
--- /dev/null
+++ b/math/s_fminl.c
@@ -0,0 +1,29 @@
+/* Return minimum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+
+long double
+__fminl (long double x, long double y)
+{
+ return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fminl, fminl)
diff --git a/math/s_ldexp.c b/math/s_ldexp.c
new file mode 100644
index 0000000000..62e123cd01
--- /dev/null
+++ b/math/s_ldexp.c
@@ -0,0 +1,37 @@
+/* @(#)s_ldexp.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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $";
+#endif
+
+#include <math.h>
+#include "math_private.h"
+#include <errno.h>
+
+#ifdef __STDC__
+ double __ldexp(double value, int exp)
+#else
+ double __ldexp(value, exp)
+ double value; int exp;
+#endif
+{
+ if(!__finite(value)||value==0.0) return value;
+ value = __scalbn(value,exp);
+ if(!__finite(value)||value==0.0) __set_errno (ERANGE);
+ return value;
+}
+weak_alias (__ldexp, ldexp)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ldexp, __ldexpl)
+weak_alias (__ldexp, ldexpl)
+#endif
diff --git a/math/s_ldexpf.c b/math/s_ldexpf.c
new file mode 100644
index 0000000000..1ea5e09f8f
--- /dev/null
+++ b/math/s_ldexpf.c
@@ -0,0 +1,37 @@
+/* s_ldexpf.c -- float version of s_ldexp.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_ldexpf.c,v 1.3 1995/05/10 20:47:42 jtc Exp $";
+#endif
+
+#include <math.h>
+#include "math_private.h"
+#include <errno.h>
+
+#ifdef __STDC__
+ float __ldexpf(float value, int exp)
+#else
+ float __ldexpf(value, exp)
+ float value; int exp;
+#endif
+{
+ if(!__finitef(value)||value==(float)0.0) return value;
+ value = __scalbnf(value,exp);
+ if(!__finitef(value)||value==(float)0.0) __set_errno (ERANGE);
+ return value;
+}
+INTDEF(__ldexpf)
+weak_alias (__ldexpf, ldexpf)
diff --git a/math/s_ldexpl.c b/math/s_ldexpl.c
new file mode 100644
index 0000000000..df8b29f94d
--- /dev/null
+++ b/math/s_ldexpl.c
@@ -0,0 +1,37 @@
+/* s_ldexpl.c -- long double version of s_ldexp.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+#include <math.h>
+#include "math_private.h"
+#include <errno.h>
+
+#ifdef __STDC__
+ long double __ldexpl(long double value, int exp)
+#else
+ long double __ldexpl(value, exp)
+ long double value; int exp;
+#endif
+{
+ if(!__finitel(value)||value==0.0) return value;
+ value = __scalbnl(value,exp);
+ if(!__finitel(value)||value==0.0) __set_errno (ERANGE);
+ return value;
+}
+weak_alias (__ldexpl, ldexpl)
diff --git a/math/s_log1pl.c b/math/s_log1pl.c
new file mode 100644
index 0000000000..e5db9078bf
--- /dev/null
+++ b/math/s_log1pl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__log1pl (long double x)
+{
+ fputs ("__log1pl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+weak_alias (__log1pl, log1pl)
+
+stub_warning (log1pl)
+#include <stub-tag.h>
diff --git a/math/s_nan.c b/math/s_nan.c
new file mode 100644
index 0000000000..9b2c50558b
--- /dev/null
+++ b/math/s_nan.c
@@ -0,0 +1,44 @@
+/* Return quiet nan.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ieee754.h>
+
+
+double
+__nan (const char *tagp)
+{
+ if (tagp[0] != '\0')
+ {
+ char buf[6 + strlen (tagp)];
+ sprintf (buf, "NAN(%s)", tagp);
+ return strtod (buf, NULL);
+ }
+
+ return NAN;
+}
+weak_alias (__nan, nan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__nan, __nanl)
+weak_alias (__nan, nanl)
+#endif
diff --git a/math/s_nanf.c b/math/s_nanf.c
new file mode 100644
index 0000000000..2e1b1eb911
--- /dev/null
+++ b/math/s_nanf.c
@@ -0,0 +1,40 @@
+/* Return quiet nan.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ieee754.h>
+
+
+float
+__nanf (const char *tagp)
+{
+ if (tagp[0] != '\0')
+ {
+ char buf[6 + strlen (tagp)];
+ sprintf (buf, "NAN(%s)", tagp);
+ return strtof (buf, NULL);
+ }
+
+ return NAN;
+}
+weak_alias (__nanf, nanf)
diff --git a/math/s_nanl.c b/math/s_nanl.c
new file mode 100644
index 0000000000..9709b92383
--- /dev/null
+++ b/math/s_nanl.c
@@ -0,0 +1,40 @@
+/* Return quiet nan.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ieee754.h>
+
+
+long double
+__nanl (const char *tagp)
+{
+ if (tagp[0] != '\0')
+ {
+ char buf[6 + strlen (tagp)];
+ sprintf (buf, "NAN(%s)", tagp);
+ return strtold (buf, NULL);
+ }
+
+ return NAN;
+}
+weak_alias (__nanl, nanl)
diff --git a/math/s_nextafter.c b/math/s_nextafter.c
new file mode 100644
index 0000000000..d2af52dda3
--- /dev/null
+++ b/math/s_nextafter.c
@@ -0,0 +1,100 @@
+/* @(#)s_nextafter.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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp $";
+#endif
+
+/* IEEE functions
+ * nextafter(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * Special cases:
+ */
+
+/* Ugly hack so that the aliasing works. */
+#define __nexttoward __internal___nexttoward
+#define nexttoward __internal_nexttoward
+
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+#ifdef __STDC__
+ double __nextafter(double x, double y)
+#else
+ double __nextafter(x,y)
+ double x,y;
+#endif
+{
+ int32_t hx,hy,ix,iy;
+ u_int32_t lx,ly;
+
+ EXTRACT_WORDS(hx,lx,x);
+ EXTRACT_WORDS(hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = hy&0x7fffffff; /* |y| */
+
+ if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */
+ ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */
+ return x+y;
+ if(x==y) return y; /* x=y, return y */
+ if((ix|lx)==0) { /* x == 0 */
+ double u;
+ INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */
+ u = math_opt_barrier (x);
+ u = u*u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
+ }
+ if(hx>=0) { /* x > 0 */
+ if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { /* x < y, x += ulp */
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ } else { /* x < 0 */
+ if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { /* x > y, x += ulp */
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ }
+ hy = hx&0x7ff00000;
+ if(hy>=0x7ff00000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
+ asm ("" : "+m"(x));
+ return x; /* overflow */
+ }
+ if(hy<0x00100000) {
+ double u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
+ }
+ INSERT_WORDS(x,hx,lx);
+ return x;
+}
+weak_alias (__nextafter, nextafter)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__nextafter, __nextafterl)
+weak_alias (__nextafter, nextafterl)
+strong_alias (__nextafter, __nexttowardl)
+weak_alias (__nexttowardl, nexttowardl)
+#undef __nexttoward
+strong_alias (__nextafter, __nexttoward)
+#undef nexttoward
+weak_alias (__nextafter, nexttoward)
+#endif
diff --git a/math/s_nexttowardf.c b/math/s_nexttowardf.c
new file mode 100644
index 0000000000..0494d1a4e9
--- /dev/null
+++ b/math/s_nexttowardf.c
@@ -0,0 +1,85 @@
+/* Single precision version of nexttoward.c.
+ Conversion to IEEE single float by Jakub Jelinek, jj@ultra.linux.cz. */
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+/* IEEE functions
+ * nexttowardf(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * This is for machines which use the same binary type for double and
+ * long double.
+ * Special cases:
+ */
+
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+#ifdef __STDC__
+ float __nexttowardf(float x, long double y)
+#else
+ float __nexttowardf(x,y)
+ float x;
+ long double y;
+#endif
+{
+ int32_t hx,hy,ix,iy;
+ u_int32_t ly;
+
+ GET_FLOAT_WORD(hx,x);
+ EXTRACT_WORDS(hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = hy&0x7fffffff; /* |y| */
+
+ if((ix>0x7f800000) || /* x is nan */
+ ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */
+ return x+y;
+ if((long double) x==y) return y; /* x=y, return y */
+ if(ix==0) { /* x == 0 */
+ float u;
+ SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
+ }
+ if(hx>=0) { /* x > 0 */
+ if(hy<0||(ix>>23)>(iy>>20)-0x380
+ || ((ix>>23)==(iy>>20)-0x380
+ && (ix&0x7fffff)>(((hy<<3)|(ly>>29))&0x7fffff))) /* x > y, x -= ulp */
+ hx -= 1;
+ else /* x < y, x += ulp */
+ hx += 1;
+ } else { /* x < 0 */
+ if(hy>=0||(ix>>23)>(iy>>20)-0x380
+ || ((ix>>23)==(iy>>20)-0x380
+ && (ix&0x7fffff)>(((hy<<3)|(ly>>29))&0x7fffff))) /* x < y, x -= ulp */
+ hx -= 1;
+ else /* x > y, x += ulp */
+ hx += 1;
+ }
+ hy = hx&0x7f800000;
+ if(hy>=0x7f800000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0)
+ /* Force conversion to float. */
+ asm ("" : "+m"(x));
+ return x;
+ }
+ if(hy<0x00800000) {
+ float u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
+ }
+ SET_FLOAT_WORD(x,hx);
+ return x;
+}
+weak_alias (__nexttowardf, nexttowardf)
diff --git a/math/s_nexttowardl.c b/math/s_nexttowardl.c
new file mode 100644
index 0000000000..73c3610fc1
--- /dev/null
+++ b/math/s_nexttowardl.c
@@ -0,0 +1 @@
+/* This function is the same as nextafterl so we use an alias there. */
diff --git a/math/s_significand.c b/math/s_significand.c
new file mode 100644
index 0000000000..4a02dbcba1
--- /dev/null
+++ b/math/s_significand.c
@@ -0,0 +1,39 @@
+/* @(#)s_signif.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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_significand.c,v 1.6 1995/05/10 20:48:11 jtc Exp $";
+#endif
+
+/*
+ * significand(x) computes just
+ * scalb(x, (double) -ilogb(x)),
+ * for exercising the fraction-part(F) IEEE 754-1985 test vector.
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __significand(double x)
+#else
+ double __significand(x)
+ double x;
+#endif
+{
+ return __ieee754_scalb(x,(double) -__ilogb(x));
+}
+weak_alias (__significand, significand)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__significand, __significandl)
+weak_alias (__significand, significandl)
+#endif
diff --git a/math/s_significandf.c b/math/s_significandf.c
new file mode 100644
index 0000000000..69de1e6b0e
--- /dev/null
+++ b/math/s_significandf.c
@@ -0,0 +1,32 @@
+/* s_significandf.c -- float version of s_significand.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_significandf.c,v 1.3 1995/05/10 20:48:13 jtc Exp $";
+#endif
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __significandf(float x)
+#else
+ float __significandf(x)
+ float x;
+#endif
+{
+ return __ieee754_scalbf(x,(float) -__ilogbf(x));
+}
+weak_alias (__significandf, significandf)
diff --git a/math/s_significandl.c b/math/s_significandl.c
new file mode 100644
index 0000000000..9fa0e4ff91
--- /dev/null
+++ b/math/s_significandl.c
@@ -0,0 +1,39 @@
+/* s_significandl.c -- long double version of s_significand.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * significandl(x) computes just
+ * scalbl(x, (long double) -ilogbl(x)),
+ * for exercising the fraction-part(F) IEEE 754-1985 test vector.
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __significandl(long double x)
+#else
+ long double __significandl(x)
+ long double x;
+#endif
+{
+ return __ieee754_scalbl(x,(long double) -ilogbl(x));
+}
+weak_alias (__significandl, significandl)
diff --git a/math/s_tanhl.c b/math/s_tanhl.c
new file mode 100644
index 0000000000..bc9a2d7f48
--- /dev/null
+++ b/math/s_tanhl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__tanhl(long double x)
+{
+ fputs ("__tanhl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+weak_alias (__tanhl, tanhl)
+stub_warning (tanhl)
+#include <stub-tag.h>
diff --git a/math/setfpucw.c b/math/setfpucw.c
new file mode 100644
index 0000000000..cb50f9f3f1
--- /dev/null
+++ b/math/setfpucw.c
@@ -0,0 +1,37 @@
+/* Set the FPU control word.
+ Copyright (C) 1996, 1997, 1999 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. */
+
+#include <math.h>
+#include <fpu_control.h>
+
+void
+__setfpucw (fpu_control_t set)
+{
+ fpu_control_t cw;
+
+ /* Fetch the current control word. */
+ _FPU_GETCW (cw);
+
+ /* Preserve the reserved bits, and set the rest as the user
+ specified (or the default, if the user gave zero). */
+ cw &= _FPU_RESERVED;
+ cw |= set & ~_FPU_RESERVED;
+
+ _FPU_SETCW (cw);
+}
diff --git a/math/t_sincosl.c b/math/t_sincosl.c
new file mode 100644
index 0000000000..6b271e6ff1
--- /dev/null
+++ b/math/t_sincosl.c
@@ -0,0 +1 @@
+/* Empty. Not needed unless ldbl __kernel_* functions use it. */
diff --git a/math/test-misc.c b/math/test-misc.c
index fa958d486c..862e11f0c3 100644
--- a/math/test-misc.c
+++ b/math/test-misc.c
@@ -1,5 +1,5 @@
/* Miscellaneous tests which don't fit anywhere else.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -44,7 +44,6 @@ main (void)
}
}
-# if __GNUC__ >= 3 || __GNUC_MINOR__ >= 96
{
long double x;
long double m;
@@ -52,17 +51,17 @@ main (void)
int e;
int i;
-# if LDBL_MANT_DIG == 64
+# if LDBL_MANT_DIG == 64
m = 0xf.fffffffffffffffp-4L;
-# elif LDBL_MANT_DIG == 106
+# elif LDBL_MANT_DIG == 106
/* This has to match the mantissa of LDBL_MAX which actually does have a
missing bit in the middle. */
m = 0x1.fffffffffffff7ffffffffffff8p-1L;
-# elif LDBL_MANT_DIG == 113
+# elif LDBL_MANT_DIG == 113
m = 0x1.ffffffffffffffffffffffffffffp-1L;
-# else
-# error "Please adjust"
-# endif
+# else
+# error "Please adjust"
+# endif
for (i = LDBL_MAX_EXP, x = LDBL_MAX; i >= LDBL_MIN_EXP; --i, x /= 2.0L)
{
@@ -106,9 +105,8 @@ main (void)
}
}
-# endif
-#if 0
+# if 0
{
int e;
long double r = frexpl (LDBL_MIN * LDBL_EPSILON, &e);
@@ -126,7 +124,7 @@ main (void)
result = 1;
}
}
-#endif
+# endif
#endif
{
@@ -1143,5 +1141,99 @@ main (void)
}
#endif
+ /* The tests here are very similar to tests earlier in this file,
+ the important difference is just that there are no intervening
+ union variables that cause some GCC versions to hide possible
+ bugs in nextafter* implementation. */
+ if (nextafterf (nextafterf (FLT_MIN, FLT_MIN / 2.0), FLT_MIN) != FLT_MIN)
+ {
+ puts ("nextafterf FLT_MIN test failed");
+ result = 1;
+ }
+ if (nextafterf (nextafterf (-FLT_MIN, -FLT_MIN / 2.0), -FLT_MIN)
+ != -FLT_MIN)
+ {
+ puts ("nextafterf -FLT_MIN test failed");
+ result = 1;
+ }
+ if (nextafter (nextafter (DBL_MIN, DBL_MIN / 2.0), DBL_MIN) != DBL_MIN)
+ {
+ puts ("nextafter DBL_MIN test failed");
+ result = 1;
+ }
+ if (nextafter (nextafter (-DBL_MIN, -DBL_MIN / 2.0), -DBL_MIN) != -DBL_MIN)
+ {
+ puts ("nextafter -DBL_MIN test failed");
+ result = 1;
+ }
+#ifndef NO_LONG_DOUBLE
+ if (nextafterl (nextafterl (LDBL_MIN, LDBL_MIN / 2.0), LDBL_MIN)
+ != LDBL_MIN)
+ {
+ puts ("nextafterl LDBL_MIN test failed");
+ result = 1;
+ }
+ if (nextafterl (nextafterl (-LDBL_MIN, -LDBL_MIN / 2.0), -LDBL_MIN)
+ != -LDBL_MIN)
+ {
+ puts ("nextafterl -LDBL_MIN test failed");
+ result = 1;
+ }
+#endif
+
+ volatile float f1 = FLT_MAX;
+ volatile float f2 = FLT_MAX / 2;
+ (void) &f1;
+ (void) &f2;
+ feclearexcept (FE_ALL_EXCEPT);
+ f2 += f1;
+ int fe = fetestexcept (FE_ALL_EXCEPT);
+ if (fe != (FE_OVERFLOW | FE_INEXACT))
+ {
+ printf ("float overflow test failed: %x\n", fe);
+ result = 1;
+ }
+
+ volatile double d1 = DBL_MAX;
+ volatile double d2 = DBL_MAX / 2;
+ (void) &d1;
+ (void) &d2;
+ feclearexcept (FE_ALL_EXCEPT);
+ d2 += d1;
+ fe = fetestexcept (FE_ALL_EXCEPT);
+ if (fe != (FE_OVERFLOW | FE_INEXACT))
+ {
+ printf ("double overflow test failed: %x\n", fe);
+ result = 1;
+ }
+
+#ifndef NO_LONG_DOUBLE
+ volatile long double ld1 = LDBL_MAX;
+ volatile long double ld2 = LDBL_MAX / 2;
+ (void) &ld1;
+ (void) &ld2;
+ feclearexcept (FE_ALL_EXCEPT);
+ ld2 += ld1;
+ fe = fetestexcept (FE_ALL_EXCEPT);
+ if (fe != (FE_OVERFLOW | FE_INEXACT))
+ {
+ printf ("long double overflow test failed: %x\n", fe);
+ result = 1;
+ }
+#endif
+
+#if !defined NO_LONG_DOUBLE && LDBL_MANT_DIG == 113
+ volatile long double ld3 = 0x1.0000000000010000000100000001p+1;
+ volatile long double ld4 = 0x1.0000000000000000000000000001p+1;
+ (void) &ld3;
+ (void) &ld4;
+ ld3 -= ld4;
+ if (ld3 != 0x1.0p-47)
+ {
+ printf ("long double subtraction test failed %.28La\n", ld3);
+ result = 1;
+ }
+#endif
+
return result;
}
diff --git a/math/test-tgmath-int.c b/math/test-tgmath-int.c
new file mode 100644
index 0000000000..99ebe9f508
--- /dev/null
+++ b/math/test-tgmath-int.c
@@ -0,0 +1,71 @@
+/* Test compilation of tgmath macros.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 2005.
+
+ 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 <math.h>
+#include <complex.h>
+#include <tgmath.h>
+#include <stdio.h>
+
+static int errors = 0;
+
+static void
+our_error (const char *c)
+{
+ puts (c);
+ ++errors;
+}
+
+#define CHECK_RET_CONST_TYPE(func, rettype, name) \
+ if (sizeof (func) != sizeof (rettype)) \
+ our_error ("Return size of " #name " is " #func" wrong");
+
+#define CHECK_RET_CONST_FLOAT(func, name) \
+ CHECK_RET_CONST_TYPE (func, float, name)
+
+#define CHECK_RET_CONST_DOUBLE(func, name) \
+ CHECK_RET_CONST_TYPE (func, double, name)
+
+static int
+do_test (void)
+{
+ int i;
+ float f;
+ double d;
+
+ CHECK_RET_CONST_DOUBLE (sin (i), "sin (i)");
+ CHECK_RET_CONST_DOUBLE (pow (i, i), "pow (i, i)");
+ CHECK_RET_CONST_DOUBLE (pow (i, i), "pow (i, i)");
+ CHECK_RET_CONST_DOUBLE (pow (i, f), "pow (i, f)");
+ CHECK_RET_CONST_DOUBLE (pow (i, d), "pow (i, d)");
+ CHECK_RET_CONST_DOUBLE (pow (f, i), "pow (f, i)");
+ CHECK_RET_CONST_DOUBLE (pow (d, i), "pow (d, i)");
+ CHECK_RET_CONST_DOUBLE (fma (i, i, i), "fma (i, i, i)");
+ CHECK_RET_CONST_DOUBLE (fma (f, i, i), "fma (f, i, i)");
+ CHECK_RET_CONST_DOUBLE (fma (i, f, i), "fma (i, f, i)");
+ CHECK_RET_CONST_DOUBLE (fma (i, i, f), "fma (i, i, f)");
+ CHECK_RET_CONST_DOUBLE (fma (d, i, i), "fma (d, i, i)");
+ CHECK_RET_CONST_DOUBLE (fma (i, d, i), "fma (i, d, i)");
+ CHECK_RET_CONST_DOUBLE (fma (i, i, d), "fma (i, i, d)");
+
+ return errors != 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/math/tgmath.h b/math/tgmath.h
index ab2cc929ad..f3d23f6e52 100644
--- a/math/tgmath.h
+++ b/math/tgmath.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004
+/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -98,7 +98,8 @@
__tgmres; }))
# define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
- (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \
+ (__extension__ ({ __typeof((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0) __tgmres; \
if ((sizeof (Val1) > sizeof (double) \
|| sizeof (Val2) > sizeof (double)) \
&& __builtin_classify_type ((Val1) + (Val2)) == 8) \
@@ -113,7 +114,8 @@
__tgmres; }))
# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
- (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \
+ (__extension__ ({ __typeof((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0) __tgmres; \
if ((sizeof (Val1) > sizeof (double) \
|| sizeof (Val2) > sizeof (double)) \
&& __builtin_classify_type ((Val1) + (Val2)) == 8) \
@@ -128,7 +130,9 @@
__tgmres; }))
# define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
- (__extension__ ({ __tgmath_real_type ((Val1) + (Val2) + (Val3)) __tgmres;\
+ (__extension__ ({ __typeof((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0 \
+ + (__tgmath_real_type (Val3)) 0) __tgmres; \
if ((sizeof (Val1) > sizeof (double) \
|| sizeof (Val2) > sizeof (double) \
|| sizeof (Val3) > sizeof (double)) \
@@ -209,7 +213,8 @@
/* XXX This definition has to be changed as soon as the compiler understands
the imaginary keyword. */
# define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
- (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \
+ (__extension__ ({ __typeof((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0) __tgmres; \
if ((sizeof (__real__ (Val1)) > sizeof (double) \
|| sizeof (__real__ (Val2)) > sizeof (double)) \
&& __builtin_classify_type (__real__ (Val1) \
diff --git a/math/w_acos.c b/math/w_acos.c
new file mode 100644
index 0000000000..f4e6e3c910
--- /dev/null
+++ b/math/w_acos.c
@@ -0,0 +1,48 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrap_acos(x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __acos(double x) /* wrapper acos */
+#else
+ double __acos(x) /* wrapper acos */
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__acos, acos)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__acos, __acosl)
+weak_alias (__acos, acosl)
+#endif
diff --git a/math/w_acosf.c b/math/w_acosf.c
new file mode 100644
index 0000000000..a8998efb84
--- /dev/null
+++ b/math/w_acosf.c
@@ -0,0 +1,48 @@
+/* w_acosf.c -- float version of w_acos.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrap_acosf(x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __acosf(float x) /* wrapper acosf */
+#else
+ float __acosf(x) /* wrapper acosf */
+ float x;
+#endif
+{
+#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
+}
+weak_alias (__acosf, acosf)
diff --git a/math/w_acosh.c b/math/w_acosh.c
new file mode 100644
index 0000000000..e8322ec667
--- /dev/null
+++ b/math/w_acosh.c
@@ -0,0 +1,47 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper acosh(x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __acosh(double x) /* wrapper acosh */
+#else
+ double __acosh(x) /* wrapper acosh */
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__acosh, acosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__acosh, __acoshl)
+weak_alias (__acosh, acoshl)
+#endif
diff --git a/math/w_acoshf.c b/math/w_acoshf.c
new file mode 100644
index 0000000000..62f94b80e7
--- /dev/null
+++ b/math/w_acoshf.c
@@ -0,0 +1,48 @@
+/* w_acoshf.c -- float version of w_acosh.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ *
+ */
+
+#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
+
+/*
+ * wrapper acoshf(x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __acoshf(float x) /* wrapper acoshf */
+#else
+ float __acoshf(x) /* wrapper acoshf */
+ float x;
+#endif
+{
+#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
+}
+weak_alias (__acoshf, acoshf)
diff --git a/math/w_acoshl.c b/math/w_acoshl.c
new file mode 100644
index 0000000000..ae67911ae5
--- /dev/null
+++ b/math/w_acoshl.c
@@ -0,0 +1,47 @@
+/* w_acoshl.c -- long double version of w_acosh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper acoshl(x)
+ */
+
+#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
+{
+#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
+}
+weak_alias (__acoshl, acoshl)
diff --git a/math/w_acosl.c b/math/w_acosl.c
new file mode 100644
index 0000000000..9ab4de899f
--- /dev/null
+++ b/math/w_acosl.c
@@ -0,0 +1,48 @@
+/* w_acosl.c -- long double version of w_acos.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrap_acosl(x)
+ */
+
+#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
+{
+#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
+}
+weak_alias (__acosl, acosl)
diff --git a/math/w_asin.c b/math/w_asin.c
new file mode 100644
index 0000000000..d531fbd26a
--- /dev/null
+++ b/math/w_asin.c
@@ -0,0 +1,49 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper asin(x)
+ */
+
+
+#include <math.h>
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __asin(double x) /* wrapper asin */
+#else
+ double __asin(x) /* wrapper asin */
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__asin, asin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__asin, __asinl)
+weak_alias (__asin, asinl)
+#endif
diff --git a/math/w_asinf.c b/math/w_asinf.c
new file mode 100644
index 0000000000..b19b5c54e3
--- /dev/null
+++ b/math/w_asinf.c
@@ -0,0 +1,49 @@
+/* w_asinf.c -- float version of w_asin.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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)
+ */
+
+
+#include <math.h>
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __asinf(float x) /* wrapper asinf */
+#else
+ float __asinf(x) /* wrapper asinf */
+ float x;
+#endif
+{
+#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
+}
+weak_alias (__asinf, asinf)
diff --git a/math/w_asinl.c b/math/w_asinl.c
new file mode 100644
index 0000000000..fb5ee35fc0
--- /dev/null
+++ b/math/w_asinl.c
@@ -0,0 +1,49 @@
+/* w_asinl.c -- long double version of w_asin.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper asinl(x)
+ */
+
+
+#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
+{
+#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
+}
+weak_alias (__asinl, asinl)
diff --git a/math/w_atan2.c b/math/w_atan2.c
new file mode 100644
index 0000000000..f0a10d4102
--- /dev/null
+++ b/math/w_atan2.c
@@ -0,0 +1,47 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper atan2(y,x)
+ */
+
+#include <math.h>
+#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
+{
+#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
+}
+weak_alias (__atan2, atan2)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__atan2, __atan2l)
+weak_alias (__atan2, atan2l)
+#endif
diff --git a/math/w_atan2f.c b/math/w_atan2f.c
new file mode 100644
index 0000000000..efb08f076b
--- /dev/null
+++ b/math/w_atan2f.c
@@ -0,0 +1,46 @@
+/* w_atan2f.c -- float version of w_atan2.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper atan2f(y,x)
+ */
+
+#include <math.h>
+#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
+{
+#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
+}
+weak_alias (__atan2f, atan2f)
diff --git a/math/w_atan2l.c b/math/w_atan2l.c
new file mode 100644
index 0000000000..9672e9615f
--- /dev/null
+++ b/math/w_atan2l.c
@@ -0,0 +1,47 @@
+/* w_atan2l.c -- long double version of w_atan2.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper atan2l(y,x)
+ */
+
+#include <math.h>
+#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
+{
+#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
+}
+weak_alias (__atan2l, atan2l)
diff --git a/math/w_atanh.c b/math/w_atanh.c
new file mode 100644
index 0000000000..b81f65c311
--- /dev/null
+++ b/math/w_atanh.c
@@ -0,0 +1,52 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper atanh(x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __atanh(double x) /* wrapper atanh */
+#else
+ double __atanh(x) /* wrapper atanh */
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__atanh, atanh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__atanh, __atanhl)
+weak_alias (__atanh, atanhl)
+#endif
diff --git a/math/w_atanhf.c b/math/w_atanhf.c
new file mode 100644
index 0000000000..52a144c05a
--- /dev/null
+++ b/math/w_atanhf.c
@@ -0,0 +1,53 @@
+/* w_atanhf.c -- float version of w_atanh.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper atanhf(x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __atanhf(float x) /* wrapper atanhf */
+#else
+ float __atanhf(x) /* wrapper atanhf */
+ float x;
+#endif
+{
+#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
+}
+weak_alias (__atanhf, atanhf)
diff --git a/math/w_atanhl.c b/math/w_atanhl.c
new file mode 100644
index 0000000000..5ce53b847d
--- /dev/null
+++ b/math/w_atanhl.c
@@ -0,0 +1,52 @@
+/* w_atanhl.c -- long double version of w_atanh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper atanhl(x)
+ */
+
+#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
+{
+#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
+}
+weak_alias (__atanhl, atanhl)
diff --git a/math/w_cosh.c b/math/w_cosh.c
new file mode 100644
index 0000000000..033a034059
--- /dev/null
+++ b/math/w_cosh.c
@@ -0,0 +1,47 @@
+/* @(#)w_cosh.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.
+ * ====================================================
+ */
+
+#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)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __cosh(double x) /* wrapper cosh */
+#else
+ double __cosh(x) /* wrapper cosh */
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__cosh, cosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cosh, __coshl)
+weak_alias (__cosh, coshl)
+#endif
diff --git a/math/w_coshf.c b/math/w_coshf.c
new file mode 100644
index 0000000000..8e24ca9adc
--- /dev/null
+++ b/math/w_coshf.c
@@ -0,0 +1,47 @@
+/* w_coshf.c -- float version of w_cosh.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+{
+#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
+}
+weak_alias (__coshf, coshf)
diff --git a/math/w_coshl.c b/math/w_coshl.c
new file mode 100644
index 0000000000..5f4623a81a
--- /dev/null
+++ b/math/w_coshl.c
@@ -0,0 +1,47 @@
+/* w_acoshl.c -- long double version of w_acosh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper coshl(x)
+ */
+
+#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
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_coshl(x);
+#else
+ long double z;
+ z = __ieee754_coshl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(!__finite(z) && __finite(x)) {
+ return __kernel_standard(x,x,205); /* cosh overflow */
+ } else
+ return z;
+#endif
+}
+weak_alias (__coshl, coshl)
diff --git a/math/w_drem.c b/math/w_drem.c
new file mode 100644
index 0000000000..9e2b1e7472
--- /dev/null
+++ b/math/w_drem.c
@@ -0,0 +1,20 @@
+/*
+ * drem() wrapper for remainder().
+ *
+ * Written by J.T. Conklin, <jtc@wimsey.com>
+ * Placed into the Public Domain, 1994.
+ */
+
+#include <math.h>
+
+double
+__drem(x, y)
+ double x, y;
+{
+ return __remainder(x, y);
+}
+weak_alias (__drem, drem)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__drem, __dreml)
+weak_alias (__drem, dreml)
+#endif
diff --git a/math/w_dremf.c b/math/w_dremf.c
new file mode 100644
index 0000000000..c3d391d634
--- /dev/null
+++ b/math/w_dremf.c
@@ -0,0 +1,17 @@
+/*
+ * dremf() wrapper for remainderf().
+ *
+ * Written by J.T. Conklin, <jtc@wimsey.com>
+ * Placed into the Public Domain, 1994.
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+float
+__dremf(x, y)
+ float x, y;
+{
+ return __remainderf(x, y);
+}
+weak_alias (__dremf, dremf)
diff --git a/math/w_dreml.c b/math/w_dreml.c
new file mode 100644
index 0000000000..aa73eedc49
--- /dev/null
+++ b/math/w_dreml.c
@@ -0,0 +1,18 @@
+/*
+ * dreml() wrapper for remainderl().
+ *
+ * Written by J.T. Conklin, <jtc@wimsey.com>
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ * Placed into the Public Domain, 1994.
+ */
+
+#include <math.h>
+
+long double
+__dreml(x, y)
+ long double x, y;
+{
+ return __remainderl(x, y);
+}
+weak_alias (__dreml, dreml)
diff --git a/math/w_exp10.c b/math/w_exp10.c
new file mode 100644
index 0000000000..9447d8fa2a
--- /dev/null
+++ b/math/w_exp10.c
@@ -0,0 +1,51 @@
+/* @(#)w_exp10.c
+ * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+/*
+ * ====================================================
+ * 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)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __exp10(double x) /* wrapper exp10 */
+#else
+ double __exp10(x) /* wrapper exp10 */
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__exp10, exp10)
+strong_alias (__exp10, __pow10)
+weak_alias (__pow10, pow10)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__exp10, __exp10l)
+weak_alias (__exp10, exp10l)
+strong_alias (__exp10l, __pow10l)
+weak_alias (__pow10l, pow10l)
+#endif
diff --git a/math/w_exp10f.c b/math/w_exp10f.c
new file mode 100644
index 0000000000..78e71be069
--- /dev/null
+++ b/math/w_exp10f.c
@@ -0,0 +1,46 @@
+/* w_exp10f.c -- float version of w_exp10.c.
+ * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+/*
+ * ====================================================
+ * 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)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __exp10f(float x) /* wrapper exp10f */
+#else
+ float __exp10f(x) /* wrapper exp10f */
+ float x;
+#endif
+{
+#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
+}
+weak_alias (__exp10f, exp10f)
+strong_alias (__exp10f, __pow10f)
+weak_alias (__pow10f, pow10f)
diff --git a/math/w_exp10l.c b/math/w_exp10l.c
new file mode 100644
index 0000000000..368ed77304
--- /dev/null
+++ b/math/w_exp10l.c
@@ -0,0 +1,46 @@
+/* w_exp10l.c -- long double version of w_exp10.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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)
+ */
+
+#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
+{
+#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
+}
+weak_alias (__exp10l, exp10l)
+strong_alias (__exp10l, __pow10l)
+weak_alias (__pow10l, pow10l)
diff --git a/math/w_exp2.c b/math/w_exp2.c
new file mode 100644
index 0000000000..446e5ea91c
--- /dev/null
+++ b/math/w_exp2.c
@@ -0,0 +1,36 @@
+/*
+ * wrapper exp2(x)
+ */
+
+#include <float.h>
+#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);
+
+double
+__exp2 (double x) /* wrapper exp2 */
+{
+#ifdef _IEEE_LIBM
+ 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
+strong_alias (__exp2, __exp2l)
+weak_alias (__exp2, exp2l)
+#endif
diff --git a/math/w_exp2f.c b/math/w_exp2f.c
new file mode 100644
index 0000000000..9120c88b60
--- /dev/null
+++ b/math/w_exp2f.c
@@ -0,0 +1,32 @@
+/*
+ * wrapper exp2f(x)
+ */
+
+#include <float.h>
+#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);
+
+float
+__exp2f (float x) /* wrapper exp2f */
+{
+#ifdef _IEEE_LIBM
+ 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
new file mode 100644
index 0000000000..fea5425ac4
--- /dev/null
+++ b/math/w_exp2l.c
@@ -0,0 +1,31 @@
+/*
+ * wrapper exp2l(x)
+ */
+
+#include <float.h>
+#include <math.h>
+#include "math_private.h"
+
+static const long double o_threshold = (long double) LDBL_MAX_EXP;
+static const long double u_threshold
+ = (long double) (LDBL_MIN_EXP - LDBL_MANT_DIG - 1);
+
+long double
+__exp2l (long double x) /* wrapper exp2l */
+{
+#ifdef _IEEE_LIBM
+ 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_expl.c b/math/w_expl.c
new file mode 100644
index 0000000000..70096a820c
--- /dev/null
+++ b/math/w_expl.c
@@ -0,0 +1,13 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__expl(long double x)
+{
+ fputs ("__expl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+weak_alias (__expl, expl)
diff --git a/math/w_fmod.c b/math/w_fmod.c
new file mode 100644
index 0000000000..43a1d8ef5c
--- /dev/null
+++ b/math/w_fmod.c
@@ -0,0 +1,48 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper fmod(x,y)
+ */
+
+#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
+{
+#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(y==0.0) {
+ return __kernel_standard(x,y,27); /* fmod(x,0) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__fmod, fmod)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fmod, __fmodl)
+weak_alias (__fmod, fmodl)
+#endif
diff --git a/math/w_fmodf.c b/math/w_fmodf.c
new file mode 100644
index 0000000000..2bd133f2d7
--- /dev/null
+++ b/math/w_fmodf.c
@@ -0,0 +1,48 @@
+/* w_fmodf.c -- float version of w_fmod.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper fmodf(x,y)
+ */
+
+#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
+{
+#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(y==(float)0.0) {
+ /* fmodf(x,0) */
+ return (float)__kernel_standard((double)x,(double)y,127);
+ } else
+ return z;
+#endif
+}
+weak_alias (__fmodf, fmodf)
diff --git a/math/w_fmodl.c b/math/w_fmodl.c
new file mode 100644
index 0000000000..7b9a297cfd
--- /dev/null
+++ b/math/w_fmodl.c
@@ -0,0 +1,48 @@
+/* w_fmodl.c -- long double version of w_fmod.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper fmodl(x,y)
+ */
+
+#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
+{
+#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(y==0.0) {
+ return __kernel_standard(x,y,227); /* fmod(x,0) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__fmodl, fmodl)
diff --git a/math/w_hypot.c b/math/w_hypot.c
new file mode 100644
index 0000000000..ab929f78ad
--- /dev/null
+++ b/math/w_hypot.c
@@ -0,0 +1,48 @@
+/* @(#)w_hypot.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.
+ * ====================================================
+ */
+
+#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)
+ */
+
+#include <math.h>
+#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
+{
+#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
+}
+weak_alias (__hypot, hypot)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__hypot, __hypotl)
+weak_alias (__hypot, hypotl)
+#endif
diff --git a/math/w_hypotf.c b/math/w_hypotf.c
new file mode 100644
index 0000000000..b6be39e39f
--- /dev/null
+++ b/math/w_hypotf.c
@@ -0,0 +1,48 @@
+/* w_hypotf.c -- float version of w_hypot.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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)
+ */
+
+#include <math.h>
+#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
+{
+#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))
+ /* hypot overflow */
+ return (float)__kernel_standard((double)x,(double)y,104);
+ else
+ return z;
+#endif
+}
+weak_alias (__hypotf, hypotf)
diff --git a/math/w_hypotl.c b/math/w_hypotl.c
new file mode 100644
index 0000000000..916afbd417
--- /dev/null
+++ b/math/w_hypotl.c
@@ -0,0 +1,48 @@
+/* w_hypotl.c -- long double version of w_hypot.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper hypotl(x,y)
+ */
+
+#include <math.h>
+#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
+{
+#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
+}
+weak_alias (__hypotl, hypotl)
diff --git a/math/w_j0.c b/math/w_j0.c
new file mode 100644
index 0000000000..5ab3544aa7
--- /dev/null
+++ b/math/w_j0.c
@@ -0,0 +1,76 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper j0(double x), y0(double x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ double j0(double x) /* wrapper j0 */
+#else
+ double j0(x) /* wrapper j0 */
+ double x;
+#endif
+{
+#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
+}
+#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
+{
+#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
+}
+#ifdef NO_LONG_DOUBLE
+strong_alias (y0, y0l)
+#endif
diff --git a/math/w_j0f.c b/math/w_j0f.c
new file mode 100644
index 0000000000..bb2b82f060
--- /dev/null
+++ b/math/w_j0f.c
@@ -0,0 +1,74 @@
+/* w_j0f.c -- float version of w_j0.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper j0f(float x), y0f(float x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ float j0f(float x) /* wrapper j0f */
+#else
+ float j0f(x) /* wrapper j0f */
+ float x;
+#endif
+{
+#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
+}
+
+#ifdef __STDC__
+ float y0f(float x) /* wrapper y0f */
+#else
+ float y0f(x) /* wrapper y0f */
+ float x;
+#endif
+{
+#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
+}
diff --git a/math/w_j0l.c b/math/w_j0l.c
new file mode 100644
index 0000000000..1ec6e9e0c2
--- /dev/null
+++ b/math/w_j0l.c
@@ -0,0 +1,76 @@
+/* w_j0l.c -- long double version of w_j0.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper j0l(long double x), y0l(long double x)
+ */
+
+#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
+{
+#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
+}
+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
+{
+#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
+}
+
+weak_alias (__y0l, y0l)
diff --git a/math/w_j1.c b/math/w_j1.c
new file mode 100644
index 0000000000..db8c4ce333
--- /dev/null
+++ b/math/w_j1.c
@@ -0,0 +1,77 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper of j1,y1
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ double j1(double x) /* wrapper j1 */
+#else
+ double j1(x) /* wrapper j1 */
+ double x;
+#endif
+{
+#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
+}
+#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
+{
+#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
+}
+#ifdef NO_LONG_DOUBLE
+strong_alias (y1, y1l)
+#endif
diff --git a/math/w_j1f.c b/math/w_j1f.c
new file mode 100644
index 0000000000..35b186206e
--- /dev/null
+++ b/math/w_j1f.c
@@ -0,0 +1,75 @@
+/* w_j1f.c -- float version of w_j1.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper of j1f,y1f
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ float j1f(float x) /* wrapper j1f */
+#else
+ float j1f(x) /* wrapper j1f */
+ float x;
+#endif
+{
+#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
+}
+
+#ifdef __STDC__
+ float y1f(float x) /* wrapper y1f */
+#else
+ float y1f(x) /* wrapper y1f */
+ float x;
+#endif
+{
+#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
+}
diff --git a/math/w_j1l.c b/math/w_j1l.c
new file mode 100644
index 0000000000..7bd31ad995
--- /dev/null
+++ b/math/w_j1l.c
@@ -0,0 +1,76 @@
+/* w_j1l.c -- long double version of w_j1.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper of j1l,y1l
+ */
+
+#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
+{
+#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
+}
+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
+{
+#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
+}
+weak_alias (__y1l, y1l)
diff --git a/math/w_jn.c b/math/w_jn.c
new file mode 100644
index 0000000000..3a28443dcf
--- /dev/null
+++ b/math/w_jn.c
@@ -0,0 +1,99 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * 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.
+ *
+ */
+
+#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
+{
+#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
+}
+#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
+{
+#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
+}
+#ifdef NO_LONG_DOUBLE
+strong_alias (yn, ynl)
+#endif
diff --git a/math/w_jnf.c b/math/w_jnf.c
new file mode 100644
index 0000000000..628701d7fa
--- /dev/null
+++ b/math/w_jnf.c
@@ -0,0 +1,71 @@
+/* w_jnf.c -- float version of w_jn.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+#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
+{
+#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
+}
+
+#ifdef __STDC__
+ float ynf(int n, float x) /* wrapper ynf */
+#else
+ float ynf(n,x) /* wrapper ynf */
+ float x; int n;
+#endif
+{
+#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
+}
diff --git a/math/w_jnl.c b/math/w_jnl.c
new file mode 100644
index 0000000000..4bb4d6b620
--- /dev/null
+++ b/math/w_jnl.c
@@ -0,0 +1,98 @@
+/* w_jnl.c -- long double version of w_jn.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * 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.
+ *
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __jnl(int n, long double x) /* wrapper jnl */
+#else
+ long double __jnl(n,x) /* wrapper jnl */
+ long double x; int n;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_jnl(n,x);
+#else
+ long double z;
+ z = __ieee754_jnl(n,x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(fabsl(x)>X_TLOSS) {
+ return __kernel_standard((double)n,x,238); /* jn(|x|>X_TLOSS,n) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__jnl, jnl)
+
+#ifdef __STDC__
+ long double __ynl(int n, long double x) /* wrapper ynl */
+#else
+ long double __ynl(n,x) /* wrapper ynl */
+ long double x; int n;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_ynl(n,x);
+#else
+ long double z;
+ z = __ieee754_ynl(n,x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(x <= 0.0){
+ if(x==0.0)
+ /* d= -one/(x-x); */
+ return __kernel_standard((double)n,x,212);
+ else
+ /* d = zero/(x-x); */
+ return __kernel_standard((double)n,x,213);
+ }
+ if(x>X_TLOSS) {
+ return __kernel_standard((double)n,x,239); /* yn(x>X_TLOSS,n) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__ynl, ynl)
diff --git a/math/w_lgamma.c b/math/w_lgamma.c
new file mode 100644
index 0000000000..ab75f75997
--- /dev/null
+++ b/math/w_lgamma.c
@@ -0,0 +1,60 @@
+/* @(#)w_lgamma.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.
+ * ====================================================
+ */
+
+#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.
+ *
+ * Method: call __ieee754_lgamma_r
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __lgamma(double x)
+#else
+ double __lgamma(x)
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__lgamma, lgamma)
+strong_alias (__lgamma, __gamma)
+weak_alias (__gamma, gamma)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lgamma, __lgammal)
+weak_alias (__lgamma, lgammal)
+strong_alias (__gamma, __gammal)
+weak_alias (__gamma, gammal)
+#endif
diff --git a/math/w_lgamma_r.c b/math/w_lgamma_r.c
new file mode 100644
index 0000000000..17a7d013e9
--- /dev/null
+++ b/math/w_lgamma_r.c
@@ -0,0 +1,51 @@
+/* @(#)wr_lgamma.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.
+ * ====================================================
+ */
+
+#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)
+ */
+
+#include <math.h>
+#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
+{
+#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
+}
+weak_alias (__lgamma_r, lgamma_r)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lgamma_r, __lgammal_r)
+weak_alias (__lgamma_r, lgammal_r)
+#endif
diff --git a/math/w_lgammaf.c b/math/w_lgammaf.c
new file mode 100644
index 0000000000..7c3c058d75
--- /dev/null
+++ b/math/w_lgammaf.c
@@ -0,0 +1,53 @@
+/* w_lgammaf.c -- float version of w_lgamma.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+{
+#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
+}
+weak_alias (__lgammaf, lgammaf)
+strong_alias (__lgammaf, __gammaf)
+weak_alias (__gammaf, gammaf)
diff --git a/math/w_lgammaf_r.c b/math/w_lgammaf_r.c
new file mode 100644
index 0000000000..a32c325638
--- /dev/null
+++ b/math/w_lgammaf_r.c
@@ -0,0 +1,52 @@
+/* w_lgammaf_r.c -- float version of w_lgamma_r.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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)
+ */
+
+#include <math.h>
+#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
+{
+#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
+}
+weak_alias (__lgammaf_r, lgammaf_r)
diff --git a/math/w_lgammal.c b/math/w_lgammal.c
new file mode 100644
index 0000000000..f250e50388
--- /dev/null
+++ b/math/w_lgammal.c
@@ -0,0 +1,58 @@
+/* w_lgammal.c -- long double version of w_lgamma.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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.
+ *
+ * Method: call __ieee754_lgammal_r
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __lgammal(long double x)
+#else
+ long double __lgammal(x)
+ long double x;
+#endif
+{
+#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
+}
+weak_alias (__lgammal, lgammal)
+strong_alias (__lgammal, __gammal)
+weak_alias (__gammal, gammal)
diff --git a/math/w_lgammal_r.c b/math/w_lgammal_r.c
new file mode 100644
index 0000000000..2dfea8a465
--- /dev/null
+++ b/math/w_lgammal_r.c
@@ -0,0 +1,52 @@
+/* w_lgammal_r.c -- long double version of w_lgamma_r.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper long double lgammal_r(long double x, int *signgamp)
+ */
+
+#include <math.h>
+#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
+{
+#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
+}
+weak_alias (__lgammal_r, lgammal_r)
diff --git a/math/w_log.c b/math/w_log.c
new file mode 100644
index 0000000000..6f6f74fd14
--- /dev/null
+++ b/math/w_log.c
@@ -0,0 +1,48 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper log(x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __log(double x) /* wrapper log */
+#else
+ double __log(x) /* wrapper log */
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__log, log)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__log, __logl)
+weak_alias (__log, logl)
+#endif
diff --git a/math/w_log10.c b/math/w_log10.c
new file mode 100644
index 0000000000..9425db3ddf
--- /dev/null
+++ b/math/w_log10.c
@@ -0,0 +1,51 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper log10(X)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __log10(double x) /* wrapper log10 */
+#else
+ double __log10(x) /* wrapper log10 */
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__log10, log10)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__log10, __log10l)
+weak_alias (__log10, log10l)
+#endif
diff --git a/math/w_log10f.c b/math/w_log10f.c
new file mode 100644
index 0000000000..c63fcd1ec2
--- /dev/null
+++ b/math/w_log10f.c
@@ -0,0 +1,52 @@
+/* w_log10f.c -- float version of w_log10.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper log10f(X)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __log10f(float x) /* wrapper log10f */
+#else
+ float __log10f(x) /* wrapper log10f */
+ float x;
+#endif
+{
+#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
+}
+weak_alias (__log10f, log10f)
diff --git a/math/w_log10l.c b/math/w_log10l.c
new file mode 100644
index 0000000000..25c051d375
--- /dev/null
+++ b/math/w_log10l.c
@@ -0,0 +1,51 @@
+/* w_log10l.c -- long double version of w_log10.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper log10l(X)
+ */
+
+#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
+{
+#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
+}
+weak_alias (__log10l, log10l)
diff --git a/math/w_log2.c b/math/w_log2.c
new file mode 100644
index 0000000000..d56a6ee663
--- /dev/null
+++ b/math/w_log2.c
@@ -0,0 +1,32 @@
+/*
+ * wrapper log2(X)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+double
+__log2 (double x) /* wrapper log2 */
+{
+#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 (x == 0.0)
+ return __kernel_standard (x, x, 48); /* log2 (0) */
+ else
+ return __kernel_standard (x, x, 49); /* log2 (x < 0) */
+ }
+ else
+ return z;
+#endif
+}
+weak_alias (__log2, log2)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__log2, __log2l)
+weak_alias (__log2, log2l)
+#endif
diff --git a/math/w_log2f.c b/math/w_log2f.c
new file mode 100644
index 0000000000..ec8d297161
--- /dev/null
+++ b/math/w_log2f.c
@@ -0,0 +1,30 @@
+/*
+ * wrapper log2(X)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+float
+__log2f (float x) /* wrapper log2f */
+{
+#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 (x == 0.0f)
+ /* log2f (0) */
+ return __kernel_standard ((double) x, (double) x, 148);
+ else
+ /* log2f (x < 0) */
+ return __kernel_standard ((double) x, (double) x, 149);
+ }
+ else
+ return z;
+#endif
+}
+weak_alias (__log2f, log2f)
diff --git a/math/w_log2l.c b/math/w_log2l.c
new file mode 100644
index 0000000000..b1d8706f2a
--- /dev/null
+++ b/math/w_log2l.c
@@ -0,0 +1,28 @@
+/*
+ * wrapper log2l(X)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+long double
+__log2l (long double x) /* wrapper log2l */
+{
+#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 (x == 0.0)
+ return __kernel_standard (x, x, 248); /* log2l (0) */
+ else
+ return __kernel_standard (x, x, 249); /* log2l (x < 0) */
+ }
+ else
+ return z;
+#endif
+}
+weak_alias (__log2l, log2l)
diff --git a/math/w_logf.c b/math/w_logf.c
new file mode 100644
index 0000000000..46d9749114
--- /dev/null
+++ b/math/w_logf.c
@@ -0,0 +1,49 @@
+/* w_logf.c -- float version of w_log.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper logf(x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __logf(float x) /* wrapper logf */
+#else
+ float __logf(x) /* wrapper logf */
+ float x;
+#endif
+{
+#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
+}
+weak_alias (__logf, logf)
diff --git a/math/w_logl.c b/math/w_logl.c
new file mode 100644
index 0000000000..5a38f20038
--- /dev/null
+++ b/math/w_logl.c
@@ -0,0 +1,48 @@
+/* w_logl.c -- long double version of w_log.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper logl(x)
+ */
+
+#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
+{
+#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
+}
+weak_alias (__logl, logl)
diff --git a/math/w_pow.c b/math/w_pow.c
new file mode 100644
index 0000000000..707cffcc43
--- /dev/null
+++ b/math/w_pow.c
@@ -0,0 +1,70 @@
+
+
+/* @(#)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.
+ * ====================================================
+ */
+
+/*
+ * wrapper pow(x,y) return x**y
+ */
+
+#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
+{
+#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) */
+ else
+ return __kernel_standard(x,y,43); /* pow(+0.0,negative) */
+ }
+ 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 */
+ }
+ }
+ if(z==0.0&&__finite(x)&&__finite(y))
+ return __kernel_standard(x,y,22); /* pow underflow */
+ return z;
+#endif
+}
+weak_alias (__pow, pow)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__pow, __powl)
+weak_alias (__pow, powl)
+#endif
diff --git a/math/w_powf.c b/math/w_powf.c
new file mode 100644
index 0000000000..2480fe559e
--- /dev/null
+++ b/math/w_powf.c
@@ -0,0 +1,77 @@
+/* w_powf.c -- float version of w_pow.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper powf(x,y) return x**y
+ */
+
+#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
+{
+#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);
+ else
+ return (float)__kernel_standard((double)x,(double)y,143);
+ }
+ 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);
+ }
+ }
+ if(z==(float)0.0&&__finitef(x)&&__finitef(y))
+ /* powf underflow */
+ return (float)__kernel_standard((double)x,(double)y,122);
+ return z;
+#endif
+}
+weak_alias (__powf, powf)
diff --git a/math/w_powl.c b/math/w_powl.c
new file mode 100644
index 0000000000..d8be7b7b03
--- /dev/null
+++ b/math/w_powl.c
@@ -0,0 +1,68 @@
+/* w_powl.c -- long double version of w_pow.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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 powl(x,y) return x**y
+ */
+
+#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
+{
+#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) */
+ else
+ return __kernel_standard(x,y,243); /* pow(+0.0,negative) */
+ }
+ 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 */
+ }
+ }
+ if(z==0.0&&__finitel(x)&&__finitel(y))
+ return __kernel_standard(x,y,222); /* pow underflow */
+ return z;
+#endif
+}
+weak_alias (__powl, powl)
diff --git a/math/w_remainder.c b/math/w_remainder.c
new file mode 100644
index 0000000000..9d7a7c5383
--- /dev/null
+++ b/math/w_remainder.c
@@ -0,0 +1,47 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper remainder(x,p)
+ */
+
+#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
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_remainder(x,y);
+#else
+ double z;
+ z = __ieee754_remainder(x,y);
+ if(_LIB_VERSION == _IEEE_ || __isnan(y)) return z;
+ if(y==0.0)
+ return __kernel_standard(x,y,28); /* remainder(x,0) */
+ else
+ return z;
+#endif
+}
+weak_alias (__remainder, remainder)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__remainder, __remainderl)
+weak_alias (__remainder, remainderl)
+#endif
diff --git a/math/w_remainderf.c b/math/w_remainderf.c
new file mode 100644
index 0000000000..486e626c28
--- /dev/null
+++ b/math/w_remainderf.c
@@ -0,0 +1,47 @@
+/* w_remainderf.c -- float version of w_remainder.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper remainderf(x,p)
+ */
+
+#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
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_remainderf(x,y);
+#else
+ float z;
+ z = __ieee754_remainderf(x,y);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(y)) return z;
+ if(y==(float)0.0)
+ /* remainder(x,0) */
+ return (float)__kernel_standard((double)x,(double)y,128);
+ else
+ return z;
+#endif
+}
+weak_alias (__remainderf, remainderf)
diff --git a/math/w_remainderl.c b/math/w_remainderl.c
new file mode 100644
index 0000000000..7635fb9363
--- /dev/null
+++ b/math/w_remainderl.c
@@ -0,0 +1,48 @@
+/* w_remainderl.c -- long double version of w_remainder.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper remainderl(x,p)
+ */
+
+#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
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_remainderl(x,y);
+#else
+ long double z;
+ z = __ieee754_remainderl(x,y);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(y)) return z;
+ if(y==0.0)
+ return __kernel_standard(x,y,228); /* remainder(x,0) */
+ else
+ return z;
+#endif
+}
+weak_alias (__remainderl, remainderl)
diff --git a/math/w_scalb.c b/math/w_scalb.c
new file mode 100644
index 0000000000..0086c2adfd
--- /dev/null
+++ b/math/w_scalb.c
@@ -0,0 +1,65 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper scalb(double x, double fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbn() instead.
+ */
+
+#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
+{
+#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
+}
+weak_alias (__scalb, scalb)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__scalb, __scalbl)
+weak_alias (__scalb, scalbl)
+#endif
diff --git a/math/w_scalbf.c b/math/w_scalbf.c
new file mode 100644
index 0000000000..60cb5670ed
--- /dev/null
+++ b/math/w_scalbf.c
@@ -0,0 +1,66 @@
+/* w_scalbf.c -- float version of w_scalb.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper scalbf(float x, float fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbn() instead.
+ */
+
+#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
+{
+#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
+}
+weak_alias (__scalbf, scalbf)
diff --git a/math/w_scalbl.c b/math/w_scalbl.c
new file mode 100644
index 0000000000..c8a45d460d
--- /dev/null
+++ b/math/w_scalbl.c
@@ -0,0 +1,65 @@
+/* w_scalbl.c -- long double version of w_scalb.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper scalbl(long double x, long double fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbnl() instead.
+ */
+
+#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
+{
+#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
+}
+weak_alias (__scalbl, scalbl)
diff --git a/math/w_sinh.c b/math/w_sinh.c
new file mode 100644
index 0000000000..5bde8a2ddd
--- /dev/null
+++ b/math/w_sinh.c
@@ -0,0 +1,47 @@
+/* @(#)w_sinh.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.
+ * ====================================================
+ */
+
+#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)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __sinh(double x) /* wrapper sinh */
+#else
+ double __sinh(x) /* wrapper sinh */
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__sinh, sinh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__sinh, __sinhl)
+weak_alias (__sinh, sinhl)
+#endif
diff --git a/math/w_sinhf.c b/math/w_sinhf.c
new file mode 100644
index 0000000000..c29c46620f
--- /dev/null
+++ b/math/w_sinhf.c
@@ -0,0 +1,47 @@
+/* w_sinhf.c -- float version of w_sinh.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+{
+#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
+}
+weak_alias (__sinhf, sinhf)
diff --git a/math/w_sinhl.c b/math/w_sinhl.c
new file mode 100644
index 0000000000..19eb774d64
--- /dev/null
+++ b/math/w_sinhl.c
@@ -0,0 +1,47 @@
+/* w_sinhl.c -- long double version of w_sinh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper sinhl(x)
+ */
+
+#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
+{
+#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
+}
+weak_alias (__sinhl, sinhl)
diff --git a/math/w_sqrt.c b/math/w_sqrt.c
new file mode 100644
index 0000000000..41ab1d18b2
--- /dev/null
+++ b/math/w_sqrt.c
@@ -0,0 +1,47 @@
+/* @(#)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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper sqrt(x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __sqrt(double x) /* wrapper sqrt */
+#else
+ double __sqrt(x) /* wrapper sqrt */
+ double x;
+#endif
+{
+#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
+}
+weak_alias (__sqrt, sqrt)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__sqrt, __sqrtl)
+weak_alias (__sqrt, sqrtl)
+#endif
diff --git a/math/w_sqrtf.c b/math/w_sqrtf.c
new file mode 100644
index 0000000000..21beb550f4
--- /dev/null
+++ b/math/w_sqrtf.c
@@ -0,0 +1,47 @@
+/* w_sqrtf.c -- float version of w_sqrt.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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
+
+/*
+ * wrapper sqrtf(x)
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __sqrtf(float x) /* wrapper sqrtf */
+#else
+ float sqrt(x) /* wrapper sqrtf */
+ float x;
+#endif
+{
+#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
+}
+weak_alias (__sqrtf, sqrtf)
diff --git a/math/w_sqrtl.c b/math/w_sqrtl.c
new file mode 100644
index 0000000000..0b03eebe1d
--- /dev/null
+++ b/math/w_sqrtl.c
@@ -0,0 +1,47 @@
+/* w_sqrtl.c -- long double version of w_sqrt.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper sqrtl(x)
+ */
+
+#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
+{
+#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
+}
+weak_alias (__sqrtl, sqrtl)
diff --git a/math/w_tgamma.c b/math/w_tgamma.c
new file mode 100644
index 0000000000..3ce6e77b49
--- /dev/null
+++ b/math/w_tgamma.c
@@ -0,0 +1,56 @@
+/* @(#)w_gamma.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.
+ * ====================================================
+ */
+
+#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.
+ */
+
+#include <math.h>
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __tgamma(double x)
+#else
+ double __tgamma(x)
+ double x;
+#endif
+{
+ 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;
+
+ if(!__finite(y)&&__finite(x)) {
+ if (x == 0.0)
+ return __kernel_standard(x,x,50); /* tgamma pole */
+ else if(__floor(x)==x&&x<0.0)
+ return __kernel_standard(x,x,41); /* tgamma domain */
+ else
+ return __kernel_standard(x,x,40); /* tgamma overflow */
+ }
+ return y;
+#endif
+}
+weak_alias (__tgamma, tgamma)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__tgamma, __tgammal)
+weak_alias (__tgamma, tgammal)
+#endif
diff --git a/math/w_tgammaf.c b/math/w_tgammaf.c
new file mode 100644
index 0000000000..d3698059e7
--- /dev/null
+++ b/math/w_tgammaf.c
@@ -0,0 +1,53 @@
+/* w_gammaf.c -- float version of w_gamma.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#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 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;
+
+ if(!__finitef(y)&&__finitef(x)) {
+ 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)
+ /* tgammaf domain */
+ return (float)__kernel_standard((double)x,(double)x,141);
+ else
+ /* tgammaf overflow */
+ return (float)__kernel_standard((double)x,(double)x,140);
+ }
+ return y;
+#endif
+}
+weak_alias (__tgammaf, tgammaf)
diff --git a/math/w_tgammal.c b/math/w_tgammal.c
new file mode 100644
index 0000000000..75970a34d4
--- /dev/null
+++ b/math/w_tgammal.c
@@ -0,0 +1,55 @@
+/* w_gammal.c -- long double version of w_gamma.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* long double gammal(double x)
+ * Return the Gamma function of x.
+ */
+
+#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 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;
+
+ if(!__finitel(y)&&__finitel(x)) {
+ if(x==0.0)
+ return __kernel_standard(x,x,250); /* tgamma pole */
+ else if(__floorl(x)==x&&x<0.0)
+ return __kernel_standard(x,x,241); /* tgamma domain */
+ else
+ return __kernel_standard(x,x,240); /* tgamma overflow */
+ }
+ return y;
+#endif
+}
+weak_alias (__tgammal, tgammal)