Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--newlib/ChangeLog20
-rw-r--r--newlib/Makefile.am1
-rw-r--r--newlib/Makefile.in1
-rw-r--r--newlib/libc/include/math.h2
-rw-r--r--newlib/libc/sys/linux/Makefile.am2
-rw-r--r--newlib/libc/sys/linux/Makefile.in2
-rw-r--r--newlib/libc/sys/linux/cmath/Makefile.am28
-rw-r--r--newlib/libc/sys/linux/cmath/Makefile.in390
-rw-r--r--newlib/libc/sys/linux/cmath/math_private.h354
-rw-r--r--newlib/libc/sys/linux/cmath/s_cacos.c42
-rw-r--r--newlib/libc/sys/linux/cmath/s_cacosf.c38
-rw-r--r--newlib/libc/sys/linux/cmath/s_cacosh.c88
-rw-r--r--newlib/libc/sys/linux/cmath/s_cacoshf.c98
-rw-r--r--newlib/libc/sys/linux/cmath/s_cacoshl.c84
-rw-r--r--newlib/libc/sys/linux/cmath/s_cacosl.c38
-rw-r--r--newlib/libc/sys/linux/cmath/s_casin.c66
-rw-r--r--newlib/libc/sys/linux/cmath/s_casinf.c63
-rw-r--r--newlib/libc/sys/linux/cmath/s_casinh.c84
-rw-r--r--newlib/libc/sys/linux/cmath/s_casinhf.c80
-rw-r--r--newlib/libc/sys/linux/cmath/s_casinhl.c80
-rw-r--r--newlib/libc/sys/linux/cmath/s_casinl.c62
-rw-r--r--newlib/libc/sys/linux/cmath/s_catan.c89
-rw-r--r--newlib/libc/sys/linux/cmath/s_catanf.c85
-rw-r--r--newlib/libc/sys/linux/cmath/s_catanh.c84
-rw-r--r--newlib/libc/sys/linux/cmath/s_catanhf.c80
-rw-r--r--newlib/libc/sys/linux/cmath/s_catanhl.c80
-rw-r--r--newlib/libc/sys/linux/cmath/s_catanl.c85
-rw-r--r--newlib/libc/sys/linux/cmath/s_cbrtl.c15
-rw-r--r--newlib/libc/sys/linux/cmath/s_ccos.c80
-rw-r--r--newlib/libc/sys/linux/cmath/s_ccosf.c76
-rw-r--r--newlib/libc/sys/linux/cmath/s_ccosh.c105
-rw-r--r--newlib/libc/sys/linux/cmath/s_ccoshf.c101
-rw-r--r--newlib/libc/sys/linux/cmath/s_ccoshl.c101
-rw-r--r--newlib/libc/sys/linux/cmath/s_ccosl.c76
-rw-r--r--newlib/libc/sys/linux/cmath/s_cexp.c127
-rw-r--r--newlib/libc/sys/linux/cmath/s_cexpf.c123
-rw-r--r--newlib/libc/sys/linux/cmath/s_cexpl.c123
-rw-r--r--newlib/libc/sys/linux/cmath/s_clog.c65
-rw-r--r--newlib/libc/sys/linux/cmath/s_clog10.c65
-rw-r--r--newlib/libc/sys/linux/cmath/s_clog10f.c61
-rw-r--r--newlib/libc/sys/linux/cmath/s_clog10l.c61
-rw-r--r--newlib/libc/sys/linux/cmath/s_clogf.c61
-rw-r--r--newlib/libc/sys/linux/cmath/s_clogl.c61
-rw-r--r--newlib/libc/sys/linux/cmath/s_cpow.c34
-rw-r--r--newlib/libc/sys/linux/cmath/s_cpowf.c30
-rw-r--r--newlib/libc/sys/linux/cmath/s_cpowl.c30
-rw-r--r--newlib/libc/sys/linux/cmath/s_cproj.c51
-rw-r--r--newlib/libc/sys/linux/cmath/s_cprojf.c47
-rw-r--r--newlib/libc/sys/linux/cmath/s_cprojl.c48
-rw-r--r--newlib/libc/sys/linux/cmath/s_csin.c131
-rw-r--r--newlib/libc/sys/linux/cmath/s_csinf.c127
-rw-r--r--newlib/libc/sys/linux/cmath/s_csinh.c126
-rw-r--r--newlib/libc/sys/linux/cmath/s_csinhf.c122
-rw-r--r--newlib/libc/sys/linux/cmath/s_csinhl.c122
-rw-r--r--newlib/libc/sys/linux/cmath/s_csinl.c127
-rw-r--r--newlib/libc/sys/linux/cmath/s_csqrt.c114
-rw-r--r--newlib/libc/sys/linux/cmath/s_csqrtf.c110
-rw-r--r--newlib/libc/sys/linux/cmath/s_csqrtl.c110
-rw-r--r--newlib/libc/sys/linux/cmath/s_ctan.c74
-rw-r--r--newlib/libc/sys/linux/cmath/s_ctanf.c70
-rw-r--r--newlib/libc/sys/linux/cmath/s_ctanh.c74
-rw-r--r--newlib/libc/sys/linux/cmath/s_ctanhf.c70
-rw-r--r--newlib/libc/sys/linux/cmath/s_ctanhl.c70
-rw-r--r--newlib/libc/sys/linux/cmath/s_ctanl.c70
-rwxr-xr-xnewlib/libc/sys/linux/configure4
-rw-r--r--newlib/libc/sys/linux/configure.in2
-rw-r--r--newlib/libc/sys/linux/include/cmathcalls.h158
-rw-r--r--newlib/libc/sys/linux/include/complex.h108
-rw-r--r--newlib/libc/sys/linux/machine/i386/huge_val.h56
-rw-r--r--newlib/libm/math/Makefile.am2
-rw-r--r--newlib/libm/math/Makefile.in49
-rw-r--r--newlib/libm/math/w_sincos.c22
-rw-r--r--newlib/libm/math/wf_sincos.c33
-rw-r--r--newlib/libm/mathfp/Makefile.am2
-rw-r--r--newlib/libm/mathfp/Makefile.in89
-rw-r--r--newlib/libm/mathfp/s_sincos.c32
-rw-r--r--newlib/libm/mathfp/sf_sincos.c39
77 files changed, 5712 insertions, 68 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index c80475143..6f6f681f9 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,23 @@
+2002-08-16 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * libc/sys/linux/cmath: New directory.
+ * libc/sys/linux/include/cmathcalls.h: New file.
+ * libc/sys/linux/include/complex.h: New file.
+ * libc/sys/linux/machine/i386/huge_val.h: New file
+ * libm/math/w_sincos.c: New file
+ * libm/math/wf_sincos.c: New file
+ * libm/mathfp/s_sincos.c: New file
+ * libm/mathfp/sf_sincos.c: New file
+ * Makefile.am (LIBC_OBJECTLISTS): Add cmath/objectlist.awk.in.
+ * libc/include/math.h: Add sincos and sincosf declarations.
+ * libc/sys/linux/Makefile.am (SUBDIRS): Add cmath.
+ (SUBLIBS): Likewise.
+ * libc/sys/linux/configure.in (AC_OUTPUT): Add cmath.
+ * libm/math/Makefile.am (src): Add w_sincos.c.
+ (fsrc): Add wf_sincos.c.
+ * libm/mathfp/Makefile.am (src): Add s_sincos.c
+ (fsrc): Add sf_sincos.c.
+
2002-08-12 Jeff Johnston <jjohnstn@redhat.com>
* libc/sys/linux/machine/i386/crt0.c (__bss_start,_end):
diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 6f3a217d1..26c46dfdb 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -114,6 +114,7 @@ LIBC_OBJECTLISTS = \
libc/reent/objectlist.awk.in \
libc/errno/objectlist.awk.in \
libc/stdio/objectlist.awk.in \
+ libc/sys/linux/cmath/objectlist.awk.in \
$(MACHINE_OBJECTLIST) \
$(SYS_OBJECTLIST) \
$(SYS_MACH_OBJECTLIST)
diff --git a/newlib/Makefile.in b/newlib/Makefile.in
index a8ad97bf8..d2572a828 100644
--- a/newlib/Makefile.in
+++ b/newlib/Makefile.in
@@ -212,6 +212,7 @@ LIBC_OBJECTLISTS = \
libc/reent/objectlist.awk.in \
libc/errno/objectlist.awk.in \
libc/stdio/objectlist.awk.in \
+ libc/sys/linux/cmath/objectlist.awk.in \
$(MACHINE_OBJECTLIST) \
$(SYS_OBJECTLIST) \
$(SYS_MACH_OBJECTLIST)
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index ee2f08701..16098c66c 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -146,6 +146,7 @@ extern double fdim _PARAMS((double, double));
extern double fmax _PARAMS((double, double));
extern double fmin _PARAMS((double, double));
extern double fma _PARAMS((double, double, double));
+extern void sincos _PARAMS((double, double *, double *));
#ifndef __math_68881
extern double log1p _PARAMS((double));
@@ -247,6 +248,7 @@ extern float rintf _PARAMS((float));
extern float scalbnf _PARAMS((float, int));
extern float log1pf _PARAMS((float));
extern float expm1f _PARAMS((float));
+extern void sincosf _PARAMS((float, float *, float *));
#ifndef _REENT_ONLY
extern float acoshf _PARAMS((float));
diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am
index 69787cf8d..7e967f0c4 100644
--- a/newlib/libc/sys/linux/Makefile.am
+++ b/newlib/libc/sys/linux/Makefile.am
@@ -5,8 +5,10 @@ AUTOMAKE_OPTIONS = cygnus
INCLUDES = -I$(srcdir)/include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
SUBDIRS = machine \
+ cmath \
.
SUBLIBS = \
+ cmath/libcmath.la \
$(LINUX_MACH_LIB)
LIB_SOURCES = \
diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in
index 1f49a477b..701cf27ac 100644
--- a/newlib/libc/sys/linux/Makefile.in
+++ b/newlib/libc/sys/linux/Makefile.in
@@ -100,9 +100,11 @@ AUTOMAKE_OPTIONS = cygnus
INCLUDES = -I$(srcdir)/include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
SUBDIRS = machine \
+ cmath \
.
SUBLIBS = \
+ cmath/libcmath.la \
$(LINUX_MACH_LIB)
diff --git a/newlib/libc/sys/linux/cmath/Makefile.am b/newlib/libc/sys/linux/cmath/Makefile.am
new file mode 100644
index 000000000..6c47f2149
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/Makefile.am
@@ -0,0 +1,28 @@
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = -I$(srcdir)/../include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+LIB_SOURCES = \
+ s_cacos.c s_casinf.c s_catanh.c s_ccosh.c s_clog.c s_cpowf.c s_csinh.c s_ctan.c \
+ s_cacosf.c s_casinh.c s_catanhf.c s_ccoshf.c s_clog10.c s_csinhf.c s_ctanf.c \
+ s_cacosh.c s_casinhf.c s_clog10f.c s_cproj.c s_ctanh.c \
+ s_cacoshf.c s_cprojf.c s_ctanhf.c \
+ s_cexp.c s_clogf.c s_csqrt.c \
+ s_catan.c s_ccos.c s_cexpf.c s_csin.c s_csqrtf.c \
+ s_casin.c s_catanf.c s_ccosf.c s_cpow.c s_csinf.c
+
+libcmath_la_LDFLAGS = -Xcompiler -nostdlib
+
+if USE_LIBTOOL
+noinst_LTLIBRARIES = libcmath.la
+libcmath_la_SOURCES = $(LIB_SOURCES)
+noinst_DATA = objectlist.awk.in
+else
+noinst_LIBRARIES = lib.a
+lib_a_SOURCES = $(LIB_SOURCES)
+noinst_DATA =
+endif # USE_LIBTOOL
+
+include $(srcdir)/../../../../Makefile.shared
diff --git a/newlib/libc/sys/linux/cmath/Makefile.in b/newlib/libc/sys/linux/cmath/Makefile.in
new file mode 100644
index 000000000..fee3d914d
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/Makefile.in
@@ -0,0 +1,390 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AR = @AR@
+AS = @AS@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBTOOL = @LIBTOOL@
+LINUX_MACH_LIB = @LINUX_MACH_LIB@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+aext = @aext@
+libm_machine_dir = @libm_machine_dir@
+machine_dir = @machine_dir@
+newlib_basedir = @newlib_basedir@
+oext = @oext@
+sys_dir = @sys_dir@
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = -I$(srcdir)/../include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+LIB_SOURCES = \
+ s_cacos.c s_casinf.c s_catanh.c s_ccosh.c s_clog.c s_cpowf.c s_csinh.c s_ctan.c \
+ s_cacosf.c s_casinh.c s_catanhf.c s_ccoshf.c s_clog10.c s_csinhf.c s_ctanf.c \
+ s_cacosh.c s_casinhf.c s_clog10f.c s_cproj.c s_ctanh.c \
+ s_cacoshf.c s_cprojf.c s_ctanhf.c \
+ s_cexp.c s_clogf.c s_csqrt.c \
+ s_catan.c s_ccos.c s_cexpf.c s_csin.c s_csqrtf.c \
+ s_casin.c s_catanf.c s_ccosf.c s_cpow.c s_csinf.c
+
+
+libcmath_la_LDFLAGS = -Xcompiler -nostdlib
+
+@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libcmath.la
+@USE_LIBTOOL_TRUE@libcmath_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES)
+@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in
+@USE_LIBTOOL_FALSE@noinst_DATA =
+@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a
+@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LIBS = @LIBS@
+lib_a_LIBADD =
+@USE_LIBTOOL_FALSE@lib_a_OBJECTS = s_cacos.$(OBJEXT) s_casinf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_catanh.$(OBJEXT) s_ccosh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_clog.$(OBJEXT) s_cpowf.$(OBJEXT) s_csinh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_ctan.$(OBJEXT) s_cacosf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_casinh.$(OBJEXT) s_catanhf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_ccoshf.$(OBJEXT) s_clog10.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_csinhf.$(OBJEXT) s_ctanf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_cacosh.$(OBJEXT) s_casinhf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_clog10f.$(OBJEXT) s_cproj.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_ctanh.$(OBJEXT) s_cacoshf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_cprojf.$(OBJEXT) s_ctanhf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_cexp.$(OBJEXT) s_clogf.$(OBJEXT) s_csqrt.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_catan.$(OBJEXT) s_ccos.$(OBJEXT) s_cexpf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_csin.$(OBJEXT) s_csqrtf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_casin.$(OBJEXT) s_catanf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_ccosf.$(OBJEXT) s_cpow.$(OBJEXT) s_csinf.$(OBJEXT)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+
+libcmath_la_LIBADD =
+@USE_LIBTOOL_TRUE@libcmath_la_OBJECTS = s_cacos.lo s_casinf.lo \
+@USE_LIBTOOL_TRUE@s_catanh.lo s_ccosh.lo s_clog.lo s_cpowf.lo \
+@USE_LIBTOOL_TRUE@s_csinh.lo s_ctan.lo s_cacosf.lo s_casinh.lo \
+@USE_LIBTOOL_TRUE@s_catanhf.lo s_ccoshf.lo s_clog10.lo s_csinhf.lo \
+@USE_LIBTOOL_TRUE@s_ctanf.lo s_cacosh.lo s_casinhf.lo s_clog10f.lo \
+@USE_LIBTOOL_TRUE@s_cproj.lo s_ctanh.lo s_cacoshf.lo s_cprojf.lo \
+@USE_LIBTOOL_TRUE@s_ctanhf.lo s_cexp.lo s_clogf.lo s_csqrt.lo \
+@USE_LIBTOOL_TRUE@s_catan.lo s_ccos.lo s_cexpf.lo s_csin.lo s_csqrtf.lo \
+@USE_LIBTOOL_TRUE@s_casin.lo s_catanf.lo s_ccosf.lo s_cpow.lo \
+@USE_LIBTOOL_TRUE@s_csinf.lo
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DATA = $(noinst_DATA)
+
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+SOURCES = $(lib_a_SOURCES) $(libcmath_la_SOURCES)
+OBJECTS = $(lib_a_OBJECTS) $(libcmath_la_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../../Makefile.shared
+ cd $(top_srcdir) && $(AUTOMAKE) --cygnus cmath/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-noinstLIBRARIES:
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+distclean-noinstLIBRARIES:
+
+maintainer-clean-noinstLIBRARIES:
+
+.c.o:
+ $(COMPILE) -c $<
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+ $(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+ -rm -f *.$(OBJEXT)
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.c.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.s.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
+ -rm -f lib.a
+ $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
+ $(RANLIB) lib.a
+
+mostlyclean-noinstLTLIBRARIES:
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+
+distclean-noinstLTLIBRARIES:
+
+maintainer-clean-noinstLTLIBRARIES:
+
+libcmath.la: $(libcmath_la_OBJECTS) $(libcmath_la_DEPENDENCIES)
+ $(LINK) $(libcmath_la_LDFLAGS) $(libcmath_la_OBJECTS) $(libcmath_la_LIBADD) $(LIBS)
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = cmath
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am:
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-info-am:
+install-info: install-info-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
+ mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \
+ mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \
+ clean-noinstLTLIBRARIES clean-tags clean-generic \
+ mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-noinstLIBRARIES distclean-compile \
+ distclean-libtool distclean-noinstLTLIBRARIES \
+ distclean-tags distclean-generic clean-am
+ -rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
+ maintainer-clean-compile maintainer-clean-libtool \
+ maintainer-clean-noinstLTLIBRARIES \
+ maintainer-clean-tags maintainer-clean-generic \
+ distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
+clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \
+distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \
+maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
+check-am installcheck-am installcheck install-info-am install-info \
+install-exec-am install-exec install-data-am install-data install-am \
+install uninstall-am uninstall all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+objectlist.awk.in: $(noinst_LTLIBRARIES)
+ -rm -f objectlist.awk.in
+ for i in `ls *.lo` ; \
+ do \
+ echo $$i `pwd`/$$i >> objectlist.awk.in ; \
+ done
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/newlib/libc/sys/linux/cmath/math_private.h b/newlib/libc/sys/linux/cmath/math_private.h
new file mode 100644
index 000000000..48258ec47
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/math_private.h
@@ -0,0 +1,354 @@
+/*
+ * ====================================================
+ * 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.
+ * ====================================================
+ */
+
+/*
+ * from: @(#)fdlibm.h 5.1 93/09/24
+ * $Id$
+ */
+
+#ifndef _MATH_PRIVATE_H_
+#define _MATH_PRIVATE_H_
+
+#include <endian.h>
+#include <sys/types.h>
+#include <machine/weakalias.h>
+#include <machine/huge_val.h>
+
+#define INFINITY HUGE_VALF
+
+#define __nan(x) nan()
+#define __isnan isnan
+#define __isinf isinf
+#define __copysignf copysignf
+#define __copysign copysign
+#define __isnanf isnanf
+#define __isinff isinff
+#define __nanf(x) nanf()
+#define feraiseexcept(x) /* nothing */
+#define __sincos sincos
+#define __sincosf sincosf
+
+int __signbitd (double x);
+int __signbitf (float x);
+
+/* The original fdlibm code used statements like:
+ n0 = ((*(int*)&one)>>29)^1; * index of high word *
+ ix0 = *(n0+(int*)&x); * high word of x *
+ ix1 = *((1-n0)+(int*)&x); * low word of x *
+ to dig two 32 bit words out of the 64 bit IEEE floating point
+ value. That is non-ANSI, and, moreover, the gcc instruction
+ scheduler gets it wrong. We instead use the following macros.
+ Unlike the original code, we determine the endianness at compile
+ time, not at run time; I don't see much benefit to selecting
+ endianness at run time. */
+
+/* A union which permits us to convert between a double and two 32 bit
+ ints. */
+
+#if __FLOAT_WORD_ORDER == BIG_ENDIAN
+
+typedef union
+{
+ double value;
+ struct
+ {
+ u_int32_t msw;
+ u_int32_t lsw;
+ } parts;
+} ieee_double_shape_type;
+
+#endif
+
+#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
+
+typedef union
+{
+ double value;
+ struct
+ {
+ u_int32_t lsw;
+ u_int32_t msw;
+ } parts;
+} ieee_double_shape_type;
+
+#endif
+
+/* Get two 32 bit ints from a double. */
+
+#define EXTRACT_WORDS(ix0,ix1,d) \
+do { \
+ ieee_double_shape_type ew_u; \
+ ew_u.value = (d); \
+ (ix0) = ew_u.parts.msw; \
+ (ix1) = ew_u.parts.lsw; \
+} while (0)
+
+/* Get the more significant 32 bit int from a double. */
+
+#define GET_HIGH_WORD(i,d) \
+do { \
+ ieee_double_shape_type gh_u; \
+ gh_u.value = (d); \
+ (i) = gh_u.parts.msw; \
+} while (0)
+
+/* Get the less significant 32 bit int from a double. */
+
+#define GET_LOW_WORD(i,d) \
+do { \
+ ieee_double_shape_type gl_u; \
+ gl_u.value = (d); \
+ (i) = gl_u.parts.lsw; \
+} while (0)
+
+/* Set a double from two 32 bit ints. */
+
+#define INSERT_WORDS(d,ix0,ix1) \
+do { \
+ ieee_double_shape_type iw_u; \
+ iw_u.parts.msw = (ix0); \
+ iw_u.parts.lsw = (ix1); \
+ (d) = iw_u.value; \
+} while (0)
+
+/* Set the more significant 32 bits of a double from an int. */
+
+#define SET_HIGH_WORD(d,v) \
+do { \
+ ieee_double_shape_type sh_u; \
+ sh_u.value = (d); \
+ sh_u.parts.msw = (v); \
+ (d) = sh_u.value; \
+} while (0)
+
+/* Set the less significant 32 bits of a double from an int. */
+
+#define SET_LOW_WORD(d,v) \
+do { \
+ ieee_double_shape_type sl_u; \
+ sl_u.value = (d); \
+ sl_u.parts.lsw = (v); \
+ (d) = sl_u.value; \
+} while (0)
+
+/* A union which permits us to convert between a float and a 32 bit
+ int. */
+
+typedef union
+{
+ float value;
+ u_int32_t word;
+} ieee_float_shape_type;
+
+/* Get a 32 bit int from a float. */
+
+#define GET_FLOAT_WORD(i,d) \
+do { \
+ ieee_float_shape_type gf_u; \
+ gf_u.value = (d); \
+ (i) = gf_u.word; \
+} while (0)
+
+/* Set a float from a 32 bit int. */
+
+#define SET_FLOAT_WORD(d,i) \
+do { \
+ ieee_float_shape_type sf_u; \
+ sf_u.word = (i); \
+ (d) = sf_u.value; \
+} while (0)
+
+#if 0
+/* ieee style elementary functions */
+extern double __ieee754_sqrt (double);
+extern double __ieee754_acos (double);
+extern double __ieee754_acosh (double);
+extern double __ieee754_log (double);
+extern double __ieee754_atanh (double);
+extern double __ieee754_asin (double);
+extern double __ieee754_atan2 (double,double);
+extern double __ieee754_exp (double);
+extern double __ieee754_exp2 (double);
+extern double __ieee754_exp10 (double);
+extern double __ieee754_cosh (double);
+extern double __ieee754_fmod (double,double);
+extern double __ieee754_pow (double,double);
+extern double __ieee754_lgamma_r (double,int *);
+extern double __ieee754_gamma_r (double,int *);
+extern double __ieee754_lgamma (double);
+extern double __ieee754_gamma (double);
+extern double __ieee754_log10 (double);
+extern double __ieee754_log2 (double);
+extern double __ieee754_sinh (double);
+extern double __ieee754_hypot (double,double);
+extern double __ieee754_j0 (double);
+extern double __ieee754_j1 (double);
+extern double __ieee754_y0 (double);
+extern double __ieee754_y1 (double);
+extern double __ieee754_jn (int,double);
+extern double __ieee754_yn (int,double);
+extern double __ieee754_remainder (double,double);
+extern int32_t __ieee754_rem_pio2 (double,double*);
+extern double __ieee754_scalb (double,double);
+#endif
+
+#define __ieee754_sinh sinh
+#define __ieee754_hypot hypot
+#define __ieee754_hypotf hypotf
+#define __ieee754_logf logf
+#define __ieee754_log10 log10
+#define __ieee754_exp exp
+#define __ieee754_cosh cosh
+#define __ieee754_expf expf
+#define __ieee754_log10f log10f
+#define __ieee754_atan2 atan2
+#define __ieee754_sqrtf sqrtf
+#define __ieee754_sinhf sinhf
+#define __ieee754_log log
+#define __ieee754_sqrt sqrt
+#define __ieee754_coshf coshf
+#define __ieee754_atan2f atan2f
+
+/* fdlibm kernel function */
+extern double __kernel_standard (double,double,int);
+extern double __kernel_sin (double,double,int);
+extern double __kernel_cos (double,double);
+extern double __kernel_tan (double,double,int);
+extern int __kernel_rem_pio2 (double*,double*,int,int,int, const int32_t*);
+
+/* internal functions. */
+extern double __copysign (double x, double __y);
+
+
+/* ieee style elementary float functions */
+extern float __ieee754_sqrtf (float);
+extern float __ieee754_acosf (float);
+extern float __ieee754_acoshf (float);
+extern float __ieee754_logf (float);
+extern float __ieee754_atanhf (float);
+extern float __ieee754_asinf (float);
+extern float __ieee754_atan2f (float,float);
+extern float __ieee754_expf (float);
+extern float __ieee754_exp2f (float);
+extern float __ieee754_exp10f (float);
+extern float __ieee754_coshf (float);
+extern float __ieee754_fmodf (float,float);
+extern float __ieee754_powf (float,float);
+extern float __ieee754_lgammaf_r (float,int *);
+extern float __ieee754_gammaf_r (float,int *);
+extern float __ieee754_lgammaf (float);
+extern float __ieee754_gammaf (float);
+extern float __ieee754_log10f (float);
+extern float __ieee754_log2f (float);
+extern float __ieee754_sinhf (float);
+extern float __ieee754_hypotf (float,float);
+extern float __ieee754_j0f (float);
+extern float __ieee754_j1f (float);
+extern float __ieee754_y0f (float);
+extern float __ieee754_y1f (float);
+extern float __ieee754_jnf (int,float);
+extern float __ieee754_ynf (int,float);
+extern float __ieee754_remainderf (float,float);
+extern int32_t __ieee754_rem_pio2f (float,float*);
+extern float __ieee754_scalbf (float,float);
+
+
+/* float versions of fdlibm kernel functions */
+extern float __kernel_sinf (float,float,int);
+extern float __kernel_cosf (float,float);
+extern float __kernel_tanf (float,float,int);
+extern int __kernel_rem_pio2f (float*,float*,int,int,int, const int32_t*);
+
+
+/* ieee style elementary long double functions */
+extern long double __ieee754_sqrtl (long double);
+extern long double __ieee754_acosl (long double);
+extern long double __ieee754_acoshl (long double);
+extern long double __ieee754_logl (long double);
+extern long double __ieee754_atanhl (long double);
+extern long double __ieee754_asinl (long double);
+extern long double __ieee754_atan2l (long double,long double);
+extern long double __ieee754_expl (long double);
+extern long double __ieee754_exp2l (long double);
+extern long double __ieee754_exp10l (long double);
+extern long double __ieee754_coshl (long double);
+extern long double __ieee754_fmodl (long double,long double);
+extern long double __ieee754_powl (long double,long double);
+extern long double __ieee754_lgammal_r (long double,int *);
+extern long double __ieee754_gammal_r (long double,int *);
+extern long double __ieee754_lgammal (long double);
+extern long double __ieee754_gammal (long double);
+extern long double __ieee754_log10l (long double);
+extern long double __ieee754_log2l (long double);
+extern long double __ieee754_sinhl (long double);
+extern long double __ieee754_hypotl (long double,long double);
+extern long double __ieee754_j0l (long double);
+extern long double __ieee754_j1l (long double);
+extern long double __ieee754_y0l (long double);
+extern long double __ieee754_y1l (long double);
+extern long double __ieee754_jnl (int,long double);
+extern long double __ieee754_ynl (int,long double);
+extern long double __ieee754_remainderl (long double,long double);
+extern int __ieee754_rem_pio2l (long double,long double*);
+extern long double __ieee754_scalbl (long double,long double);
+
+/* long double versions of fdlibm kernel functions */
+extern long double __kernel_sinl (long double,long double,int);
+extern long double __kernel_cosl (long double,long double);
+extern long double __kernel_tanl (long double,long double,int);
+extern void __kernel_sincosl (long double,long double,
+ long double *,long double *, int);
+extern int __kernel_rem_pio2l (long double*,long double*,int,int,
+ int,const int*);
+
+#ifndef NO_LONG_DOUBLE
+/* prototypes required to compile the ldbl-96 support without warnings */
+extern int __finitel (long double);
+extern int __ilogbl (long double);
+extern int __isinfl (long double);
+extern int __isnanl (long double);
+extern long double __atanl (long double);
+extern long double __copysignl (long double, long double);
+extern long double __expm1l (long double);
+extern long double __floorl (long double);
+extern long double __frexpl (long double, int *);
+extern long double __ldexpl (long double, int);
+extern long double __log1pl (long double);
+extern long double __nanl (const char *);
+extern long double __rintl (long double);
+extern long double __scalbnl (long double, int);
+extern long double __sqrtl (long double x);
+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);
+#endif
+
+/* Prototypes for functions of the IBM Accurate Mathematical Library. */
+extern double __exp1 (double __x, double __xx, double __error);
+extern double __sin (double __x);
+extern double __cos (double __x);
+extern int __branred (double __x, double *__a, double *__aa);
+extern void __doasin (double __x, double __dx, double __v[]);
+extern void __dubsin (double __x, double __dx, double __v[]);
+extern void __dubcos (double __x, double __dx, double __v[]);
+extern double __halfulp (double __x, double __y);
+extern double __sin32 (double __x, double __res, double __res1);
+extern double __cos32 (double __x, double __res, double __res1);
+extern double __mpsin (double __x, double __dx);
+extern double __mpcos (double __x, double __dx);
+extern double __mpsin1 (double __x);
+extern double __mpcos1 (double __x);
+extern double __slowexp (double __x);
+extern double __slowpow (double __x, double __y, double __z);
+extern void __docos (double __x, double __dx, double __v[]);
+
+#endif /* _MATH_PRIVATE_H_ */
diff --git a/newlib/libc/sys/linux/cmath/s_cacos.c b/newlib/libc/sys/linux/cmath/s_cacos.c
new file mode 100644
index 000000000..f9864472b
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_cacos.c
@@ -0,0 +1,42 @@
+/* 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>
+#include "math_private.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/newlib/libc/sys/linux/cmath/s_cacosf.c b/newlib/libc/sys/linux/cmath/s_cacosf.c
new file mode 100644
index 000000000..bf01890ad
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_cacosf.c
@@ -0,0 +1,38 @@
+/* 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>
+#include "math_private.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;
+}
+weak_alias (__cacosf, cacosf)
diff --git a/newlib/libc/sys/linux/cmath/s_cacosh.c b/newlib/libc/sys/linux/cmath/s_cacosh.c
new file mode 100644
index 000000000..6ca3426b5
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_cacosh.c
@@ -0,0 +1,88 @@
+/* Return arc hyperbole cosine 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
+__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);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clog (y);
+ }
+
+ return res;
+}
+weak_alias (__cacosh, cacosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cacosh, __cacoshl)
+weak_alias (__cacosh, cacoshl)
+#endif
diff --git a/newlib/libc/sys/linux/cmath/s_cacoshf.c b/newlib/libc/sys/linux/cmath/s_cacoshf.c
new file mode 100644
index 000000000..69054cde3
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_cacoshf.c
@@ -0,0 +1,98 @@
+/* Return arc hyperbole cosine 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
+__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);
+
+ __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
+ }
+
+ return res;
+}
+weak_alias (__cacoshf, cacoshf)
diff --git a/newlib/libc/sys/linux/cmath/s_cacoshl.c b/newlib/libc/sys/linux/cmath/s_cacoshl.c
new file mode 100644
index 000000000..3d0cd7f2a
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_cacoshl.c
@@ -0,0 +1,84 @@
+/* Return arc hyperbole cosine 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
+__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);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clogl (y);
+ }
+
+ return res;
+}
+weak_alias (__cacoshl, cacoshl)
diff --git a/newlib/libc/sys/linux/cmath/s_cacosl.c b/newlib/libc/sys/linux/cmath/s_cacosl.c
new file mode 100644
index 000000000..d4bbfec87
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_cacosl.c
@@ -0,0 +1,38 @@
+/* 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>
+#include "math_private.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/newlib/libc/sys/linux/cmath/s_casin.c b/newlib/libc/sys/linux/cmath/s_casin.c
new file mode 100644
index 000000000..4c164b534
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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>
+#include "math_private.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/newlib/libc/sys/linux/cmath/s_casinf.c b/newlib/libc/sys/linux/cmath/s_casinf.c
new file mode 100644
index 000000000..09e52b400
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_casinf.c
@@ -0,0 +1,63 @@
+/* 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>
+#include "math_private.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;
+}
+weak_alias (__casinf, casinf)
diff --git a/newlib/libc/sys/linux/cmath/s_casinh.c b/newlib/libc/sys/linux/cmath/s_casinh.c
new file mode 100644
index 000000000..30b9dbb18
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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>
+#include "math_private.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/newlib/libc/sys/linux/cmath/s_casinhf.c b/newlib/libc/sys/linux/cmath/s_casinhf.c
new file mode 100644
index 000000000..f9fc4e73c
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_casinhf.c
@@ -0,0 +1,80 @@
+/* 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>
+#include "math_private.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;
+}
+weak_alias (__casinhf, casinhf)
diff --git a/newlib/libc/sys/linux/cmath/s_casinhl.c b/newlib/libc/sys/linux/cmath/s_casinhl.c
new file mode 100644
index 000000000..b48c60932
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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>
+#include "math_private.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/newlib/libc/sys/linux/cmath/s_casinl.c b/newlib/libc/sys/linux/cmath/s_casinl.c
new file mode 100644
index 000000000..d6b7a8087
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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>
+#include "math_private.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/newlib/libc/sys/linux/cmath/s_catan.c b/newlib/libc/sys/linux/cmath/s_catan.c
new file mode 100644
index 000000000..1d0673ad6
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_catanf.c b/newlib/libc/sys/linux/cmath/s_catanf.c
new file mode 100644
index 000000000..cc9e5ea7a
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_catanf.c
@@ -0,0 +1,85 @@
+/* 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;
+}
+weak_alias (__catanf, catanf)
diff --git a/newlib/libc/sys/linux/cmath/s_catanh.c b/newlib/libc/sys/linux/cmath/s_catanh.c
new file mode 100644
index 000000000..e15c073f9
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_catanhf.c b/newlib/libc/sys/linux/cmath/s_catanhf.c
new file mode 100644
index 000000000..30a5a1b8a
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_catanhf.c
@@ -0,0 +1,80 @@
+/* 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;
+}
+weak_alias (__catanhf, catanhf)
diff --git a/newlib/libc/sys/linux/cmath/s_catanhl.c b/newlib/libc/sys/linux/cmath/s_catanhl.c
new file mode 100644
index 000000000..c3fb0ce5f
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_catanl.c b/newlib/libc/sys/linux/cmath/s_catanl.c
new file mode 100644
index 000000000..6cb45e5be
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_cbrtl.c b/newlib/libc/sys/linux/cmath/s_cbrtl.c
new file mode 100644
index 000000000..d668e377a
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_ccos.c b/newlib/libc/sys/linux/cmath/s_ccos.c
new file mode 100644
index 000000000..e65ea38a5
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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>
+#include "math_private.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/newlib/libc/sys/linux/cmath/s_ccosf.c b/newlib/libc/sys/linux/cmath/s_ccosf.c
new file mode 100644
index 000000000..016d8062b
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_ccosf.c
@@ -0,0 +1,76 @@
+/* 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>
+#include "math_private.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;
+}
+weak_alias (__ccosf, ccosf)
diff --git a/newlib/libc/sys/linux/cmath/s_ccosh.c b/newlib/libc/sys/linux/cmath/s_ccosh.c
new file mode 100644
index 000000000..f5b29db24
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_ccoshf.c b/newlib/libc/sys/linux/cmath/s_ccoshf.c
new file mode 100644
index 000000000..339b6bc1c
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_ccoshf.c
@@ -0,0 +1,101 @@
+/* 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;
+}
+weak_alias (__ccoshf, ccoshf)
diff --git a/newlib/libc/sys/linux/cmath/s_ccoshl.c b/newlib/libc/sys/linux/cmath/s_ccoshl.c
new file mode 100644
index 000000000..61ffb49ca
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_ccosl.c b/newlib/libc/sys/linux/cmath/s_ccosl.c
new file mode 100644
index 000000000..4ebe2c347
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_cexp.c b/newlib/libc/sys/linux/cmath/s_cexp.c
new file mode 100644
index 000000000..5a299b768
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_cexpf.c b/newlib/libc/sys/linux/cmath/s_cexpf.c
new file mode 100644
index 000000000..93bfe2049
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_cexpf.c
@@ -0,0 +1,123 @@
+/* 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;
+}
+weak_alias (__cexpf, cexpf)
diff --git a/newlib/libc/sys/linux/cmath/s_cexpl.c b/newlib/libc/sys/linux/cmath/s_cexpl.c
new file mode 100644
index 000000000..cf6bc974a
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_clog.c b/newlib/libc/sys/linux/cmath/s_clog.c
new file mode 100644
index 000000000..f796024b4
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_clog10.c b/newlib/libc/sys/linux/cmath/s_clog10.c
new file mode 100644
index 000000000..62c2ca724
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_clog10f.c b/newlib/libc/sys/linux/cmath/s_clog10f.c
new file mode 100644
index 000000000..6d60c5fc2
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_clog10f.c
@@ -0,0 +1,61 @@
+/* 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;
+}
+weak_alias (__clog10f, clog10f)
diff --git a/newlib/libc/sys/linux/cmath/s_clog10l.c b/newlib/libc/sys/linux/cmath/s_clog10l.c
new file mode 100644
index 000000000..f901543d0
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_clogf.c b/newlib/libc/sys/linux/cmath/s_clogf.c
new file mode 100644
index 000000000..c7151f2e5
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_clogf.c
@@ -0,0 +1,61 @@
+/* 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;
+}
+weak_alias (__clogf, clogf)
diff --git a/newlib/libc/sys/linux/cmath/s_clogl.c b/newlib/libc/sys/linux/cmath/s_clogl.c
new file mode 100644
index 000000000..43118f768
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_cpow.c b/newlib/libc/sys/linux/cmath/s_cpow.c
new file mode 100644
index 000000000..9018a8a65
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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>
+#include "math_private.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/newlib/libc/sys/linux/cmath/s_cpowf.c b/newlib/libc/sys/linux/cmath/s_cpowf.c
new file mode 100644
index 000000000..b0c032422
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_cpowf.c
@@ -0,0 +1,30 @@
+/* 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>
+#include "math_private.h"
+
+__complex__ float
+__cpowf (__complex__ float x, __complex__ float c)
+{
+ return __cexpf (c * __clogf (x));
+}
+weak_alias (__cpowf, cpowf)
diff --git a/newlib/libc/sys/linux/cmath/s_cpowl.c b/newlib/libc/sys/linux/cmath/s_cpowl.c
new file mode 100644
index 000000000..4c358b3eb
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_cproj.c b/newlib/libc/sys/linux/cmath/s_cproj.c
new file mode 100644
index 000000000..6c9e41704
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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>
+#include "math_private.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/newlib/libc/sys/linux/cmath/s_cprojf.c b/newlib/libc/sys/linux/cmath/s_cprojf.c
new file mode 100644
index 000000000..a302078b5
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_cprojf.c
@@ -0,0 +1,47 @@
+/* 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>
+#include "math_private.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;
+}
+weak_alias (__cprojf, cprojf)
diff --git a/newlib/libc/sys/linux/cmath/s_cprojl.c b/newlib/libc/sys/linux/cmath/s_cprojl.c
new file mode 100644
index 000000000..c70cdc47d
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_csin.c b/newlib/libc/sys/linux/cmath/s_csin.c
new file mode 100644
index 000000000..eb380e2c3
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_csinf.c b/newlib/libc/sys/linux/cmath/s_csinf.c
new file mode 100644
index 000000000..b7278810d
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_csinf.c
@@ -0,0 +1,127 @@
+/* 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;
+}
+weak_alias (__csinf, csinf)
diff --git a/newlib/libc/sys/linux/cmath/s_csinh.c b/newlib/libc/sys/linux/cmath/s_csinh.c
new file mode 100644
index 000000000..f0e0cc61f
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_csinhf.c b/newlib/libc/sys/linux/cmath/s_csinhf.c
new file mode 100644
index 000000000..5cf80d0f9
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_csinhf.c
@@ -0,0 +1,122 @@
+/* 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;
+}
+weak_alias (__csinhf, csinhf)
diff --git a/newlib/libc/sys/linux/cmath/s_csinhl.c b/newlib/libc/sys/linux/cmath/s_csinhl.c
new file mode 100644
index 000000000..226075634
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_csinl.c b/newlib/libc/sys/linux/cmath/s_csinl.c
new file mode 100644
index 000000000..f7a1c4360
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/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/newlib/libc/sys/linux/cmath/s_csqrt.c b/newlib/libc/sys/linux/cmath/s_csqrt.c
new file mode 100644
index 000000000..0bb6690b1
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_csqrt.c
@@ -0,0 +1,114 @@
+/* Complex square root of double value.
+ Copyright (C) 1997, 1998 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 = __copysign (r, __imag__ x);
+ __imag__ res = r;
+ }
+ 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/newlib/libc/sys/linux/cmath/s_csqrtf.c b/newlib/libc/sys/linux/cmath/s_csqrtf.c
new file mode 100644
index 000000000..f7b18368b
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_csqrtf.c
@@ -0,0 +1,110 @@
+/* Complex square root of float value.
+ Copyright (C) 1997, 1998 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 = __copysignf (r, __imag__ x);
+ __imag__ res = r;
+ }
+ 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;
+}
+weak_alias (__csqrtf, csqrtf)
diff --git a/newlib/libc/sys/linux/cmath/s_csqrtl.c b/newlib/libc/sys/linux/cmath/s_csqrtl.c
new file mode 100644
index 000000000..8e27750a0
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_csqrtl.c
@@ -0,0 +1,110 @@
+/* Complex square root of long double value.
+ Copyright (C) 1997, 1998 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 = __copysignl (r, __imag__ x);
+ __imag__ res = r;
+ }
+ 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/newlib/libc/sys/linux/cmath/s_ctan.c b/newlib/libc/sys/linux/cmath/s_ctan.c
new file mode 100644
index 000000000..6a09fe465
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_ctan.c
@@ -0,0 +1,74 @@
+/* Complex tangent 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
+__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);
+
+ __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/newlib/libc/sys/linux/cmath/s_ctanf.c b/newlib/libc/sys/linux/cmath/s_ctanf.c
new file mode 100644
index 000000000..89bc84741
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_ctanf.c
@@ -0,0 +1,70 @@
+/* Complex tangent 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
+__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);
+
+ __real__ res = sin2rx / den;
+ __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+weak_alias (__ctanf, ctanf)
diff --git a/newlib/libc/sys/linux/cmath/s_ctanh.c b/newlib/libc/sys/linux/cmath/s_ctanh.c
new file mode 100644
index 000000000..971cd9040
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_ctanh.c
@@ -0,0 +1,74 @@
+/* Complex hyperbole tangent 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
+__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);
+
+ __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/newlib/libc/sys/linux/cmath/s_ctanhf.c b/newlib/libc/sys/linux/cmath/s_ctanhf.c
new file mode 100644
index 000000000..b9e3c57fc
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_ctanhf.c
@@ -0,0 +1,70 @@
+/* Complex hyperbole tangent 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
+__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);
+
+ __real__ res = __ieee754_sinhf (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+
+ return res;
+}
+weak_alias (__ctanhf, ctanhf)
diff --git a/newlib/libc/sys/linux/cmath/s_ctanhl.c b/newlib/libc/sys/linux/cmath/s_ctanhl.c
new file mode 100644
index 000000000..7bf6b3919
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_ctanhl.c
@@ -0,0 +1,70 @@
+/* Complex hyperbole tangent 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
+__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);
+
+ __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+
+ return res;
+}
+weak_alias (__ctanhl, ctanhl)
diff --git a/newlib/libc/sys/linux/cmath/s_ctanl.c b/newlib/libc/sys/linux/cmath/s_ctanl.c
new file mode 100644
index 000000000..fa153e9b3
--- /dev/null
+++ b/newlib/libc/sys/linux/cmath/s_ctanl.c
@@ -0,0 +1,70 @@
+/* Complex tangent 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
+__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);
+
+ __real__ res = sin2rx / den;
+ __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+weak_alias (__ctanl, ctanl)
diff --git a/newlib/libc/sys/linux/configure b/newlib/libc/sys/linux/configure
index f5e2c8860..7b7ebed61 100755
--- a/newlib/libc/sys/linux/configure
+++ b/newlib/libc/sys/linux/configure
@@ -3071,7 +3071,7 @@ done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile cmath/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -3196,7 +3196,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile cmath/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
diff --git a/newlib/libc/sys/linux/configure.in b/newlib/libc/sys/linux/configure.in
index 75143b00b..2e01a4f44 100644
--- a/newlib/libc/sys/linux/configure.in
+++ b/newlib/libc/sys/linux/configure.in
@@ -32,4 +32,4 @@ AC_SUBST(LINUX_MACH_LIB)
AC_CONFIG_SUBDIRS(machine $EXTRA_DIRS)
-AC_OUTPUT(Makefile)
+AC_OUTPUT(Makefile cmath/Makefile)
diff --git a/newlib/libc/sys/linux/include/cmathcalls.h b/newlib/libc/sys/linux/include/cmathcalls.h
new file mode 100644
index 000000000..c680c6d8e
--- /dev/null
+++ b/newlib/libc/sys/linux/include/cmathcalls.h
@@ -0,0 +1,158 @@
+/* Prototype declarations for complex math functions;
+ helper file for <complex.h>.
+ Copyright (C) 1997, 1998, 2001 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. */
+
+/* NOTE: Because of the special way this file is used by <complex.h>, this
+ file must NOT be protected from multiple inclusion as header files
+ usually are.
+
+ This file provides prototype declarations for the math functions.
+ Most functions are declared using the macro:
+
+ __MATHCALL (NAME, (ARGS...));
+
+ This means there is a function `NAME' returning `double' and a function
+ `NAMEf' returning `float'. Each place `_Mdouble_' appears in the
+ prototype, that is actually `double' in the prototype for `NAME' and
+ `float' in the prototype for `NAMEf'. Reentrant variant functions are
+ called `NAME_r' and `NAMEf_r'.
+
+ Functions returning other types like `int' are declared using the macro:
+
+ __MATHDECL (TYPE, NAME, (ARGS...));
+
+ This is just like __MATHCALL but for a function returning `TYPE'
+ instead of `_Mdouble_'. In all of these cases, there is still
+ both a `NAME' and a `NAMEf' that takes `float' arguments. */
+
+#ifndef _COMPLEX_H
+#error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead."
+#endif
+
+#define _Mdouble_complex_ _Mdouble_ _Complex
+
+
+/* Trigonometric functions. */
+
+/* Arc cosine of Z. */
+__MATHCALL (cacos, (_Mdouble_complex_ __z));
+/* Arc sine of Z. */
+__MATHCALL (casin, (_Mdouble_complex_ __z));
+/* Arc tangent of Z. */
+__MATHCALL (catan, (_Mdouble_complex_ __z));
+
+/* Cosine of Z. */
+__MATHCALL (ccos, (_Mdouble_complex_ __z));
+/* Sine of Z. */
+__MATHCALL (csin, (_Mdouble_complex_ __z));
+/* Tangent of Z. */
+__MATHCALL (ctan, (_Mdouble_complex_ __z));
+
+
+/* Hyperbolic functions. */
+
+/* Hyperbolic arc cosine of Z. */
+__MATHCALL (cacosh, (_Mdouble_complex_ __z));
+/* Hyperbolic arc sine of Z. */
+__MATHCALL (casinh, (_Mdouble_complex_ __z));
+/* Hyperbolic arc tangent of Z. */
+__MATHCALL (catanh, (_Mdouble_complex_ __z));
+
+/* Hyperbolic cosine of Z. */
+__MATHCALL (ccosh, (_Mdouble_complex_ __z));
+/* Hyperbolic sine of Z. */
+__MATHCALL (csinh, (_Mdouble_complex_ __z));
+/* Hyperbolic tangent of Z. */
+__MATHCALL (ctanh, (_Mdouble_complex_ __z));
+
+
+/* Exponential and logarithmic functions. */
+
+/* Exponential function of Z. */
+__MATHCALL (cexp, (_Mdouble_complex_ __z));
+
+/* Natural logarithm of Z. */
+__MATHCALL (clog, (_Mdouble_complex_ __z));
+
+#ifdef __USE_GNU
+/* The base 10 logarithm is not defined by the standard but to implement
+ the standard C++ library it is handy. */
+__MATHCALL (clog10, (_Mdouble_complex_ __z));
+#endif
+
+/* Power functions. */
+
+/* Return X to the Y power. */
+__MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y));
+
+/* Return the square root of Z. */
+__MATHCALL (csqrt, (_Mdouble_complex_ __z));
+
+
+/* Absolute value, conjugates, and projection. */
+
+/* Absolute value of Z. */
+__MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
+
+/* Argument value of Z. */
+__MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z));
+
+/* Complex conjugate of Z. */
+__MATHCALL (conj, (_Mdouble_complex_ __z));
+
+/* Projection of Z onto the Riemann sphere. */
+__MATHCALL (cproj, (_Mdouble_complex_ __z));
+
+
+/* Decomposing complex values. */
+
+/* Imaginary part of Z. */
+__MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
+
+/* Real part of Z. */
+__MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
+
+
+/* Now some optimized versions. GCC has handy notations for these
+ functions. Recent GCC handles these as builtin functions so does
+ not need inlines. */
+#if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__
+
+/* Imaginary part of Z. */
+extern __inline _Mdouble_
+__MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW
+{
+ return __imag__ __z;
+}
+
+/* Real part of Z. */
+extern __inline _Mdouble_
+__MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW
+{
+ return __real__ __z;
+}
+
+/* Complex conjugate of Z. */
+extern __inline _Mdouble_complex_
+__MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW
+{
+ return __extension__ ~__z;
+}
+
+#endif
diff --git a/newlib/libc/sys/linux/include/complex.h b/newlib/libc/sys/linux/include/complex.h
new file mode 100644
index 000000000..daa465674
--- /dev/null
+++ b/newlib/libc/sys/linux/include/complex.h
@@ -0,0 +1,108 @@
+/* Copyright (C) 1997, 1998, 1999, 2000 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. */
+
+/*
+ * ISO C99: 7.3 Complex arithmetic <complex.h>
+ */
+
+#ifndef _COMPLEX_H
+#define _COMPLEX_H 1
+
+#include <sys/types.h>
+#include <features.h>
+
+__BEGIN_DECLS
+
+#define __CONCAT(x,y) x ## y
+/* We might need to add support for more compilers here. But since ISO
+ C99 is out hopefully all maintained compilers will soon provide the data
+ types `float complex' and `double complex'. */
+#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97)
+# define _Complex __complex__
+#endif
+
+#define complex _Complex
+
+/* Narrowest imaginary unit. This depends on the floating-point
+ evaluation method.
+ XXX This probably has to go into a gcc related file. */
+#define _Complex_I (__extension__ 1.0iF)
+
+/* Another more descriptive name is `I'.
+ XXX Once we have the imaginary support switch this to _Imaginary_I. */
+#undef I
+#define I _Complex_I
+
+/* The file <bits/cmathcalls.h> contains the prototypes for all the
+ actual math functions. These macros are used for those prototypes,
+ so we can easily declare each function as both `name' and `__name',
+ and can declare the float versions `namef' and `__namef'. */
+
+#define __MATHCALL(function, args) \
+ __MATHDECL (_Mdouble_complex_,function, args)
+#define __MATHDECL(type, function, args) \
+ __MATHDECL_1(type, function, args); \
+ __MATHDECL_1(type, __CONCAT(__,function), args)
+#define __MATHDECL_1(type, function, args) \
+ extern type __MATH_PRECNAME(function) args __THROW
+
+#define _Mdouble_ double
+#define __MATH_PRECNAME(name) name
+#include <cmathcalls.h>
+#undef _Mdouble_
+#undef __MATH_PRECNAME
+
+/* Now the float versions. */
+#ifndef _Mfloat_
+# define _Mfloat_ float
+#endif
+#define _Mdouble_ _Mfloat_
+#ifdef __STDC__
+# define __MATH_PRECNAME(name) name##f
+#else
+# define __MATH_PRECNAME(name) name/**/f
+#endif
+#include <cmathcalls.h>
+#undef _Mdouble_
+#undef __MATH_PRECNAME
+
+#if 0
+/* 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
+# ifndef _Mlong_double_
+# define _Mlong_double_ long double
+# endif
+# define _Mdouble_ _Mlong_double_
+# ifdef __STDC__
+# define __MATH_PRECNAME(name) name##l
+# else
+# define __MATH_PRECNAME(name) name/**/l
+# endif
+# include <cmathcalls.h>
+#endif
+#endif
+#undef _Mdouble_
+#undef __MATH_PRECNAME
+#undef __MATHDECL_1
+#undef __MATHDECL
+#undef __MATHCALL
+
+__END_DECLS
+
+#endif /* complex.h */
diff --git a/newlib/libc/sys/linux/machine/i386/huge_val.h b/newlib/libc/sys/linux/machine/i386/huge_val.h
new file mode 100644
index 000000000..171517710
--- /dev/null
+++ b/newlib/libc/sys/linux/machine/i386/huge_val.h
@@ -0,0 +1,56 @@
+/* `HUGE_VAL' constants for ix86 (where it is infinity).
+ Used by <stdlib.h> and <math.h> functions for overflow.
+ Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 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 <features.h>
+
+/* ISO C99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */
+
+# if __GNUC_PREREQ(2,96)
+
+# define HUGE_VALF (__extension__ 0x1.0p255f)
+# define HUGE_VALL (__extension__ 0x1.0p32767L)
+
+# else
+
+# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f }
+
+# define __huge_valf_t union { unsigned char __c[4]; float __f; }
+# ifdef __GNUC__
+# define HUGE_VALF (__extension__ \
+ ((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f)
+# else /* Not GCC. */
+static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
+# define HUGE_VALF (__huge_valf.__f)
+# endif /* GCC. */
+
+
+# define __HUGE_VALL_bytes { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 }
+
+# define __huge_vall_t union { unsigned char __c[12]; long double __ld; }
+# ifdef __GNUC__
+# define HUGE_VALL (__extension__ \
+ ((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld)
+# else /* Not GCC. */
+static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
+# define HUGE_VALL (__huge_vall.__ld)
+# endif /* GCC. */
+
+# endif /* GCC 2.95 */
+
diff --git a/newlib/libm/math/Makefile.am b/newlib/libm/math/Makefile.am
index 038ad4ff3..6f7195a38 100644
--- a/newlib/libm/math/Makefile.am
+++ b/newlib/libm/math/Makefile.am
@@ -18,6 +18,7 @@ src = k_standard.c k_rem_pio2.c \
w_j1.c w_jn.c w_lgamma.c wr_lgamma.c \
w_log.c w_log10.c w_pow.c w_remainder.c \
w_scalb.c w_sinh.c w_sqrt.c \
+ w_sincos.c \
w_cabs.c w_drem.c \
s_asinh.c s_atan.c s_ceil.c \
s_cos.c s_erf.c s_fabs.c s_floor.c \
@@ -41,6 +42,7 @@ fsrc = kf_rem_pio2.c \
wf_j1.c wf_jn.c wf_lgamma.c wrf_lgamma.c \
wf_log.c wf_log10.c wf_pow.c wf_remainder.c \
wf_scalb.c wf_sinh.c wf_sqrt.c \
+ wf_sincos.c \
wf_cabs.c wf_drem.c \
sf_asinh.c sf_atan.c sf_ceil.c \
sf_cos.c sf_erf.c sf_fabs.c sf_floor.c \
diff --git a/newlib/libm/math/Makefile.in b/newlib/libm/math/Makefile.in
index 4d7e9fe47..6c17b2b60 100644
--- a/newlib/libm/math/Makefile.in
+++ b/newlib/libm/math/Makefile.in
@@ -112,6 +112,7 @@ src = k_standard.c k_rem_pio2.c \
w_j1.c w_jn.c w_lgamma.c wr_lgamma.c \
w_log.c w_log10.c w_pow.c w_remainder.c \
w_scalb.c w_sinh.c w_sqrt.c \
+ w_sincos.c \
w_cabs.c w_drem.c \
s_asinh.c s_atan.c s_ceil.c \
s_cos.c s_erf.c s_fabs.c s_floor.c \
@@ -136,6 +137,7 @@ fsrc = kf_rem_pio2.c \
wf_j1.c wf_jn.c wf_lgamma.c wrf_lgamma.c \
wf_log.c wf_log10.c wf_pow.c wf_remainder.c \
wf_scalb.c wf_sinh.c wf_sqrt.c \
+ wf_sincos.c \
wf_cabs.c wf_drem.c \
sf_asinh.c sf_atan.c sf_ceil.c \
sf_cos.c sf_erf.c sf_fabs.c sf_floor.c \
@@ -200,13 +202,13 @@ lib_a_LIBADD =
@USE_LIBTOOL_FALSE@wr_lgamma.$(OBJEXT) w_log.$(OBJEXT) \
@USE_LIBTOOL_FALSE@w_log10.$(OBJEXT) w_pow.$(OBJEXT) \
@USE_LIBTOOL_FALSE@w_remainder.$(OBJEXT) w_scalb.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@w_sinh.$(OBJEXT) w_sqrt.$(OBJEXT) w_cabs.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@w_drem.$(OBJEXT) s_asinh.$(OBJEXT) s_atan.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_ceil.$(OBJEXT) s_cos.$(OBJEXT) s_erf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_fabs.$(OBJEXT) s_floor.$(OBJEXT) s_frexp.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_isnan.$(OBJEXT) s_ldexp.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_signif.$(OBJEXT) s_sin.$(OBJEXT) s_tan.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_tanh.$(OBJEXT) s_isinf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@w_sinh.$(OBJEXT) w_sqrt.$(OBJEXT) w_sincos.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@w_cabs.$(OBJEXT) w_drem.$(OBJEXT) s_asinh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_atan.$(OBJEXT) s_ceil.$(OBJEXT) s_cos.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_erf.$(OBJEXT) s_fabs.$(OBJEXT) s_floor.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_frexp.$(OBJEXT) s_isnan.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_ldexp.$(OBJEXT) s_signif.$(OBJEXT) s_sin.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_tan.$(OBJEXT) s_tanh.$(OBJEXT) s_isinf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@s_infconst.$(OBJEXT) w_exp2.$(OBJEXT) \
@USE_LIBTOOL_FALSE@w_tgamma.$(OBJEXT) kf_rem_pio2.$(OBJEXT) \
@USE_LIBTOOL_FALSE@kf_cos.$(OBJEXT) kf_sin.$(OBJEXT) kf_tan.$(OBJEXT) \
@@ -231,13 +233,14 @@ lib_a_LIBADD =
@USE_LIBTOOL_FALSE@wf_log10.$(OBJEXT) wf_pow.$(OBJEXT) \
@USE_LIBTOOL_FALSE@wf_remainder.$(OBJEXT) wf_scalb.$(OBJEXT) \
@USE_LIBTOOL_FALSE@wf_sinh.$(OBJEXT) wf_sqrt.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@wf_cabs.$(OBJEXT) wf_drem.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_asinh.$(OBJEXT) sf_atan.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_ceil.$(OBJEXT) sf_cos.$(OBJEXT) sf_erf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_fabs.$(OBJEXT) sf_floor.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_frexp.$(OBJEXT) sf_isnan.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_ldexp.$(OBJEXT) sf_signif.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_sin.$(OBJEXT) sf_tan.$(OBJEXT) sf_tanh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@wf_sincos.$(OBJEXT) wf_cabs.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@wf_drem.$(OBJEXT) sf_asinh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_atan.$(OBJEXT) sf_ceil.$(OBJEXT) sf_cos.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_erf.$(OBJEXT) sf_fabs.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_floor.$(OBJEXT) sf_frexp.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_isnan.$(OBJEXT) sf_ldexp.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_signif.$(OBJEXT) sf_sin.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_tan.$(OBJEXT) sf_tanh.$(OBJEXT) \
@USE_LIBTOOL_FALSE@sf_isinf.$(OBJEXT) wf_exp2.$(OBJEXT) \
@USE_LIBTOOL_FALSE@wf_tgamma.$(OBJEXT)
LTLIBRARIES = $(noinst_LTLIBRARIES)
@@ -254,10 +257,10 @@ libmath_la_LIBADD =
@USE_LIBTOOL_TRUE@wr_gamma.lo w_hypot.lo w_j0.lo w_j1.lo w_jn.lo \
@USE_LIBTOOL_TRUE@w_lgamma.lo wr_lgamma.lo w_log.lo w_log10.lo w_pow.lo \
@USE_LIBTOOL_TRUE@w_remainder.lo w_scalb.lo w_sinh.lo w_sqrt.lo \
-@USE_LIBTOOL_TRUE@w_cabs.lo w_drem.lo s_asinh.lo s_atan.lo s_ceil.lo \
-@USE_LIBTOOL_TRUE@s_cos.lo s_erf.lo s_fabs.lo s_floor.lo s_frexp.lo \
-@USE_LIBTOOL_TRUE@s_isnan.lo s_ldexp.lo s_signif.lo s_sin.lo s_tan.lo \
-@USE_LIBTOOL_TRUE@s_tanh.lo s_isinf.lo s_infconst.lo w_exp2.lo \
+@USE_LIBTOOL_TRUE@w_sincos.lo w_cabs.lo w_drem.lo s_asinh.lo s_atan.lo \
+@USE_LIBTOOL_TRUE@s_ceil.lo s_cos.lo s_erf.lo s_fabs.lo s_floor.lo \
+@USE_LIBTOOL_TRUE@s_frexp.lo s_isnan.lo s_ldexp.lo s_signif.lo s_sin.lo \
+@USE_LIBTOOL_TRUE@s_tan.lo s_tanh.lo s_isinf.lo s_infconst.lo w_exp2.lo \
@USE_LIBTOOL_TRUE@w_tgamma.lo kf_rem_pio2.lo kf_cos.lo kf_sin.lo \
@USE_LIBTOOL_TRUE@kf_tan.lo ef_acos.lo ef_acosh.lo ef_asin.lo \
@USE_LIBTOOL_TRUE@ef_atan2.lo ef_atanh.lo ef_cosh.lo ef_exp.lo \
@@ -270,11 +273,11 @@ libmath_la_LIBADD =
@USE_LIBTOOL_TRUE@wf_hypot.lo wf_j0.lo wf_j1.lo wf_jn.lo wf_lgamma.lo \
@USE_LIBTOOL_TRUE@wrf_lgamma.lo wf_log.lo wf_log10.lo wf_pow.lo \
@USE_LIBTOOL_TRUE@wf_remainder.lo wf_scalb.lo wf_sinh.lo wf_sqrt.lo \
-@USE_LIBTOOL_TRUE@wf_cabs.lo wf_drem.lo sf_asinh.lo sf_atan.lo \
-@USE_LIBTOOL_TRUE@sf_ceil.lo sf_cos.lo sf_erf.lo sf_fabs.lo sf_floor.lo \
-@USE_LIBTOOL_TRUE@sf_frexp.lo sf_isnan.lo sf_ldexp.lo sf_signif.lo \
-@USE_LIBTOOL_TRUE@sf_sin.lo sf_tan.lo sf_tanh.lo sf_isinf.lo wf_exp2.lo \
-@USE_LIBTOOL_TRUE@wf_tgamma.lo
+@USE_LIBTOOL_TRUE@wf_sincos.lo wf_cabs.lo wf_drem.lo sf_asinh.lo \
+@USE_LIBTOOL_TRUE@sf_atan.lo sf_ceil.lo sf_cos.lo sf_erf.lo sf_fabs.lo \
+@USE_LIBTOOL_TRUE@sf_floor.lo sf_frexp.lo sf_isnan.lo sf_ldexp.lo \
+@USE_LIBTOOL_TRUE@sf_signif.lo sf_sin.lo sf_tan.lo sf_tanh.lo \
+@USE_LIBTOOL_TRUE@sf_isinf.lo wf_exp2.lo wf_tgamma.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
diff --git a/newlib/libm/math/w_sincos.c b/newlib/libm/math/w_sincos.c
new file mode 100644
index 000000000..491efa418
--- /dev/null
+++ b/newlib/libm/math/w_sincos.c
@@ -0,0 +1,22 @@
+/* sincos -- currently no more efficient than two separate calls to
+ sin and cos. */
+
+#include "fdlibm.h"
+#include <errno.h>
+
+#ifndef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+ void sincos(double x, double *sinx, double *cosx)
+#else
+ void sincos(x, sinx, cosx)
+ double x;
+ double *sinx;
+ double *cosx;
+#endif
+{
+ *sinx = sin (x);
+ *cosx = cos (x);
+}
+
+#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/math/wf_sincos.c b/newlib/libm/math/wf_sincos.c
new file mode 100644
index 000000000..477c60401
--- /dev/null
+++ b/newlib/libm/math/wf_sincos.c
@@ -0,0 +1,33 @@
+/* sincos -- currently no more efficient than two separate calls to
+ sin and cos. */
+#include "fdlibm.h"
+#include <errno.h>
+
+#ifdef __STDC__
+ void sincosf(float x, float *sinx, float *cosx)
+#else
+ void sincosf(x, sinx, cosx)
+ float x;
+ float *sinx;
+ float *cosx;
+#endif
+{
+ *sinx = sinf (x);
+ *cosx = cosf (x);
+}
+
+#ifdef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+ void sincos(double x, double *sinx, double *cosx)
+#else
+ void sincos(x, sinx, cosx)
+ double x;
+ double sinx;
+ double cosx;
+#endif
+{
+ *sinx = sinf((float) x);
+ *cosx = cosf((float) x);
+}
+#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/mathfp/Makefile.am b/newlib/libm/mathfp/Makefile.am
index 42e1989d4..92688c43d 100644
--- a/newlib/libm/mathfp/Makefile.am
+++ b/newlib/libm/mathfp/Makefile.am
@@ -13,6 +13,7 @@ src = s_acos.c s_frexp.c s_mathcnst.c \
s_atan2.c s_fabs.c s_log.c s_tanh.c \
s_log10.c s_sin.c \
s_floor.c s_sine.c \
+ s_sincos.c \
s_atangent.c s_logarithm.c \
s_sineh.c \
s_ceil.c s_isnan.c s_isinf.c \
@@ -32,6 +33,7 @@ fsrc = sf_ceil.c \
sf_atan2.c sf_fabs.c sf_tanh.c \
sf_atan.c sf_log10.c sf_sin.c\
sf_floor.c sf_sine.c \
+ sf_sincos.c \
sf_atangent.c sf_logarithm.c sf_sineh.c \
sf_log.c sf_sineh.c \
sf_isnan.c sf_isinf.c \
diff --git a/newlib/libm/mathfp/Makefile.in b/newlib/libm/mathfp/Makefile.in
index 43546b1d7..83656b30c 100644
--- a/newlib/libm/mathfp/Makefile.in
+++ b/newlib/libm/mathfp/Makefile.in
@@ -107,6 +107,7 @@ src = s_acos.c s_frexp.c s_mathcnst.c \
s_atan2.c s_fabs.c s_log.c s_tanh.c \
s_log10.c s_sin.c \
s_floor.c s_sine.c \
+ s_sincos.c \
s_atangent.c s_logarithm.c \
s_sineh.c \
s_ceil.c s_isnan.c s_isinf.c \
@@ -127,6 +128,7 @@ fsrc = sf_ceil.c \
sf_atan2.c sf_fabs.c sf_tanh.c \
sf_atan.c sf_log10.c sf_sin.c\
sf_floor.c sf_sine.c \
+ sf_sincos.c \
sf_atangent.c sf_logarithm.c sf_sineh.c \
sf_log.c sf_sineh.c \
sf_isnan.c sf_isinf.c \
@@ -203,35 +205,37 @@ lib_a_LIBADD =
@USE_LIBTOOL_FALSE@s_atan.$(OBJEXT) s_atan2.$(OBJEXT) s_fabs.$(OBJEXT) \
@USE_LIBTOOL_FALSE@s_log.$(OBJEXT) s_tanh.$(OBJEXT) s_log10.$(OBJEXT) \
@USE_LIBTOOL_FALSE@s_sin.$(OBJEXT) s_floor.$(OBJEXT) s_sine.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_atangent.$(OBJEXT) s_logarithm.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_sineh.$(OBJEXT) s_ceil.$(OBJEXT) s_isnan.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_isinf.$(OBJEXT) e_acosh.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@e_atanh.$(OBJEXT) e_remainder.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@er_gamma.$(OBJEXT) er_lgamma.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_erf.$(OBJEXT) e_j0.$(OBJEXT) e_j1.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@w_jn.$(OBJEXT) e_hypot.$(OBJEXT) w_cabs.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@w_drem.$(OBJEXT) s_asinh.$(OBJEXT) s_fmod.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@e_scalb.$(OBJEXT) s_infconst.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_signif.$(OBJEXT) s_exp2.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@s_tgamma.$(OBJEXT) sf_ceil.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_acos.$(OBJEXT) sf_frexp.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_cos.$(OBJEXT) sf_sinh.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_asine.$(OBJEXT) sf_cosh.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_ispos.$(OBJEXT) sf_numtest.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_sqrt.$(OBJEXT) sf_asin.$(OBJEXT) sf_exp.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_sincos.$(OBJEXT) s_atangent.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_logarithm.$(OBJEXT) s_sineh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_ceil.$(OBJEXT) s_isnan.$(OBJEXT) s_isinf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@e_acosh.$(OBJEXT) e_atanh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@e_remainder.$(OBJEXT) er_gamma.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@er_lgamma.$(OBJEXT) s_erf.$(OBJEXT) e_j0.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@e_j1.$(OBJEXT) w_jn.$(OBJEXT) e_hypot.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@w_cabs.$(OBJEXT) w_drem.$(OBJEXT) s_asinh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_fmod.$(OBJEXT) e_scalb.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_infconst.$(OBJEXT) s_signif.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@s_exp2.$(OBJEXT) s_tgamma.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_ceil.$(OBJEXT) sf_acos.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_frexp.$(OBJEXT) sf_cos.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_sinh.$(OBJEXT) sf_asine.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_cosh.$(OBJEXT) sf_ispos.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_numtest.$(OBJEXT) sf_sqrt.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_asin.$(OBJEXT) sf_exp.$(OBJEXT) \
@USE_LIBTOOL_FALSE@sf_ldexp.$(OBJEXT) sf_pow.$(OBJEXT) sf_tan.$(OBJEXT) \
@USE_LIBTOOL_FALSE@sf_atan2.$(OBJEXT) sf_fabs.$(OBJEXT) \
@USE_LIBTOOL_FALSE@sf_tanh.$(OBJEXT) sf_atan.$(OBJEXT) \
@USE_LIBTOOL_FALSE@sf_log10.$(OBJEXT) sf_sin.$(OBJEXT) \
@USE_LIBTOOL_FALSE@sf_floor.$(OBJEXT) sf_sine.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_atangent.$(OBJEXT) sf_logarithm.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_sineh.$(OBJEXT) sf_log.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_sineh.$(OBJEXT) sf_isnan.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_isinf.$(OBJEXT) ef_acosh.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@ef_atanh.$(OBJEXT) ef_remainder.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@erf_gamma.$(OBJEXT) erf_lgamma.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sf_erf.$(OBJEXT) ef_j0.$(OBJEXT) ef_j1.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@wf_jn.$(OBJEXT) ef_hypot.$(OBJEXT) wf_cabs.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_sincos.$(OBJEXT) sf_atangent.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_logarithm.$(OBJEXT) sf_sineh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_log.$(OBJEXT) sf_sineh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sf_isnan.$(OBJEXT) sf_isinf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@ef_acosh.$(OBJEXT) ef_atanh.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@ef_remainder.$(OBJEXT) erf_gamma.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@erf_lgamma.$(OBJEXT) sf_erf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@ef_j0.$(OBJEXT) ef_j1.$(OBJEXT) wf_jn.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@ef_hypot.$(OBJEXT) wf_cabs.$(OBJEXT) \
@USE_LIBTOOL_FALSE@wf_drem.$(OBJEXT) sf_asinh.$(OBJEXT) \
@USE_LIBTOOL_FALSE@sf_fmod.$(OBJEXT) ef_scalb.$(OBJEXT) \
@USE_LIBTOOL_FALSE@sf_signif.$(OBJEXT) sf_exp2.$(OBJEXT) \
@@ -244,24 +248,25 @@ libmathfp_la_LIBADD =
@USE_LIBTOOL_TRUE@s_cosh.lo s_ispos.lo s_numtest.lo s_sqrt.lo s_exp.lo \
@USE_LIBTOOL_TRUE@s_ldexp.lo s_pow.lo s_tan.lo s_atan.lo s_atan2.lo \
@USE_LIBTOOL_TRUE@s_fabs.lo s_log.lo s_tanh.lo s_log10.lo s_sin.lo \
-@USE_LIBTOOL_TRUE@s_floor.lo s_sine.lo s_atangent.lo s_logarithm.lo \
-@USE_LIBTOOL_TRUE@s_sineh.lo s_ceil.lo s_isnan.lo s_isinf.lo e_acosh.lo \
-@USE_LIBTOOL_TRUE@e_atanh.lo e_remainder.lo er_gamma.lo er_lgamma.lo \
-@USE_LIBTOOL_TRUE@s_erf.lo e_j0.lo e_j1.lo w_jn.lo e_hypot.lo w_cabs.lo \
-@USE_LIBTOOL_TRUE@w_drem.lo s_asinh.lo s_fmod.lo e_scalb.lo \
-@USE_LIBTOOL_TRUE@s_infconst.lo s_signif.lo s_exp2.lo s_tgamma.lo \
-@USE_LIBTOOL_TRUE@sf_ceil.lo sf_acos.lo sf_frexp.lo sf_cos.lo \
-@USE_LIBTOOL_TRUE@sf_sinh.lo sf_asine.lo sf_cosh.lo sf_ispos.lo \
-@USE_LIBTOOL_TRUE@sf_numtest.lo sf_sqrt.lo sf_asin.lo sf_exp.lo \
-@USE_LIBTOOL_TRUE@sf_ldexp.lo sf_pow.lo sf_tan.lo sf_atan2.lo \
-@USE_LIBTOOL_TRUE@sf_fabs.lo sf_tanh.lo sf_atan.lo sf_log10.lo \
-@USE_LIBTOOL_TRUE@sf_sin.lo sf_floor.lo sf_sine.lo sf_atangent.lo \
-@USE_LIBTOOL_TRUE@sf_logarithm.lo sf_sineh.lo sf_log.lo sf_sineh.lo \
-@USE_LIBTOOL_TRUE@sf_isnan.lo sf_isinf.lo ef_acosh.lo ef_atanh.lo \
-@USE_LIBTOOL_TRUE@ef_remainder.lo erf_gamma.lo erf_lgamma.lo sf_erf.lo \
-@USE_LIBTOOL_TRUE@ef_j0.lo ef_j1.lo wf_jn.lo ef_hypot.lo wf_cabs.lo \
-@USE_LIBTOOL_TRUE@wf_drem.lo sf_asinh.lo sf_fmod.lo ef_scalb.lo \
-@USE_LIBTOOL_TRUE@sf_signif.lo sf_exp2.lo sf_tgamma.lo
+@USE_LIBTOOL_TRUE@s_floor.lo s_sine.lo s_sincos.lo s_atangent.lo \
+@USE_LIBTOOL_TRUE@s_logarithm.lo s_sineh.lo s_ceil.lo s_isnan.lo \
+@USE_LIBTOOL_TRUE@s_isinf.lo e_acosh.lo e_atanh.lo e_remainder.lo \
+@USE_LIBTOOL_TRUE@er_gamma.lo er_lgamma.lo s_erf.lo e_j0.lo e_j1.lo \
+@USE_LIBTOOL_TRUE@w_jn.lo e_hypot.lo w_cabs.lo w_drem.lo s_asinh.lo \
+@USE_LIBTOOL_TRUE@s_fmod.lo e_scalb.lo s_infconst.lo s_signif.lo \
+@USE_LIBTOOL_TRUE@s_exp2.lo s_tgamma.lo sf_ceil.lo sf_acos.lo \
+@USE_LIBTOOL_TRUE@sf_frexp.lo sf_cos.lo sf_sinh.lo sf_asine.lo \
+@USE_LIBTOOL_TRUE@sf_cosh.lo sf_ispos.lo sf_numtest.lo sf_sqrt.lo \
+@USE_LIBTOOL_TRUE@sf_asin.lo sf_exp.lo sf_ldexp.lo sf_pow.lo sf_tan.lo \
+@USE_LIBTOOL_TRUE@sf_atan2.lo sf_fabs.lo sf_tanh.lo sf_atan.lo \
+@USE_LIBTOOL_TRUE@sf_log10.lo sf_sin.lo sf_floor.lo sf_sine.lo \
+@USE_LIBTOOL_TRUE@sf_sincos.lo sf_atangent.lo sf_logarithm.lo \
+@USE_LIBTOOL_TRUE@sf_sineh.lo sf_log.lo sf_sineh.lo sf_isnan.lo \
+@USE_LIBTOOL_TRUE@sf_isinf.lo ef_acosh.lo ef_atanh.lo ef_remainder.lo \
+@USE_LIBTOOL_TRUE@erf_gamma.lo erf_lgamma.lo sf_erf.lo ef_j0.lo \
+@USE_LIBTOOL_TRUE@ef_j1.lo wf_jn.lo ef_hypot.lo wf_cabs.lo wf_drem.lo \
+@USE_LIBTOOL_TRUE@sf_asinh.lo sf_fmod.lo ef_scalb.lo sf_signif.lo \
+@USE_LIBTOOL_TRUE@sf_exp2.lo sf_tgamma.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
diff --git a/newlib/libm/mathfp/s_sincos.c b/newlib/libm/mathfp/s_sincos.c
new file mode 100644
index 000000000..e313e6f1d
--- /dev/null
+++ b/newlib/libm/mathfp/s_sincos.c
@@ -0,0 +1,32 @@
+
+/* @(#)z_sin.c 1.0 98/08/13 */
+/******************************************************************
+ * Sine
+ *
+ * Input:
+ * x - floating point value
+ *
+ * Output:
+ * sine of x
+ *
+ * Description:
+ * This routine returns the sine of x.
+ *
+ *****************************************************************/
+
+#include "fdlibm.h"
+#include "zmath.h"
+
+#ifndef _DOUBLE_IS_32BITS
+
+void
+_DEFUN (sincos, (x, sinx, cosx),
+ double x _AND
+ double *sinx _AND
+ double *cosx)
+{
+ *sinx = sin (x);
+ *cosx = cos (x);
+}
+
+#endif /* _DOUBLE_IS_32BITS */
diff --git a/newlib/libm/mathfp/sf_sincos.c b/newlib/libm/mathfp/sf_sincos.c
new file mode 100644
index 000000000..e192b4b44
--- /dev/null
+++ b/newlib/libm/mathfp/sf_sincos.c
@@ -0,0 +1,39 @@
+
+/* @(#)z_sinf.c 1.0 98/08/13 */
+/******************************************************************
+ * Sine
+ *
+ * Input:
+ * x - floating point value
+ *
+ * Output:
+ * sine of x
+ *
+ * Description:
+ * This routine returns the sine of x.
+ *
+ *****************************************************************/
+
+#include "fdlibm.h"
+#include "zmath.h"
+
+void
+_DEFUN (sincosf, (x, sinx, cosx),
+ float x _AND
+ float *sinx _AND
+ float *cosx)
+{
+ *sinx = sin (x);
+ *cosx = cos (x);
+}
+
+#ifdef _DOUBLE_IS_32BITS
+
+void
+sincos (double x, double *sinx, double *cosx)
+{
+ *sinx = (double) sinf ((float) x);
+ *cosx = (double) cosf ((float) x);
+}
+
+#endif /* defined(_DOUBLE_IS_32BITS) */