]> gcc.gnu.org Git - gcc.git/commitdiff
Makefile.am: Remove OPTIMIZE_CXXFLAGS, WARN_CXXFLAGS, CONFIG_CXXFLAGS from here,...
authorBenjamin Kosnik <bkoz@gcc.gnu.org>
Sat, 7 Oct 2000 01:01:45 +0000 (01:01 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Sat, 7 Oct 2000 01:01:45 +0000 (01:01 +0000)
2000-10-06  Benjamin Kosnik  <bkoz@purist.soma.redhat.com>

* src/Makefile.am: Remove OPTIMIZE_CXXFLAGS, WARN_CXXFLAGS,
CONFIG_CXXFLAGS from here, and move to...
* src/Makefile.in: Regenerate.
* Makefile.am: ... here. Clean.
(OPTIMIZE_CXXFLAGS): Move up Makefile hierarchy to here.
(WARN_CXXFLAGS): Same.
(CONFIG_CXXFLAGS): Same.
* Makefile.in: Regenerate.
* libsupc++/Makefile.am: Use top-level OPTIMIZE_CXXFLAGS,
WARN_CXXFLAGS, CONFIG_CXXFLAGS as part of local AM_CXXFLAGS.
* libsupc++/Makefile.in: Regenerate.

Change math to libmath.
* math: Move to libmath, delete.
* libmath: New directory.
* libmath/*: Populate.
* src/Makefile.am (LIBMATH_INCLUDES): Change to libmath.
(libstdc___la_LIBADD): Same.
* src/Makefile.in: Regenerate.
* configure.in: Add AC_OUTPUT for libmath/Makefile.
* configure: Regenerate.
* Makefile.am (SUBDIRS): Add libmath.
* Makefile.in: Regenerate.
* README (file): Change name.

From-SVN: r36766

53 files changed:
libstdc++-v3/libmath/Makefile.am [new file with mode: 0644]
libstdc++-v3/libmath/Makefile.in [new file with mode: 0644]
libstdc++-v3/libmath/atan2f.c [new file with mode: 0644]
libstdc++-v3/libmath/c_log.c [new file with mode: 0644]
libstdc++-v3/libmath/c_logf.c [new file with mode: 0644]
libstdc++-v3/libmath/c_logl.c [new file with mode: 0644]
libstdc++-v3/libmath/cabs.c [new file with mode: 0644]
libstdc++-v3/libmath/cabsf.c [new file with mode: 0644]
libstdc++-v3/libmath/cabsl.c [new file with mode: 0644]
libstdc++-v3/libmath/carg.c [new file with mode: 0644]
libstdc++-v3/libmath/cargf.c [new file with mode: 0644]
libstdc++-v3/libmath/cargl.c [new file with mode: 0644]
libstdc++-v3/libmath/ccos.c [new file with mode: 0644]
libstdc++-v3/libmath/ccosf.c [new file with mode: 0644]
libstdc++-v3/libmath/ccosh.c [new file with mode: 0644]
libstdc++-v3/libmath/ccoshf.c [new file with mode: 0644]
libstdc++-v3/libmath/ccoshl.c [new file with mode: 0644]
libstdc++-v3/libmath/ccosl.c [new file with mode: 0644]
libstdc++-v3/libmath/cexp.c [new file with mode: 0644]
libstdc++-v3/libmath/cexpf.c [new file with mode: 0644]
libstdc++-v3/libmath/cexpl.c [new file with mode: 0644]
libstdc++-v3/libmath/clog10.c [new file with mode: 0644]
libstdc++-v3/libmath/clog10f.c [new file with mode: 0644]
libstdc++-v3/libmath/clog10l.c [new file with mode: 0644]
libstdc++-v3/libmath/complex-stub.h [new file with mode: 0644]
libstdc++-v3/libmath/copysignf.c [new file with mode: 0644]
libstdc++-v3/libmath/cpow.c [new file with mode: 0644]
libstdc++-v3/libmath/cpowf.c [new file with mode: 0644]
libstdc++-v3/libmath/cpowl.c [new file with mode: 0644]
libstdc++-v3/libmath/csin.c [new file with mode: 0644]
libstdc++-v3/libmath/csinf.c [new file with mode: 0644]
libstdc++-v3/libmath/csinh.c [new file with mode: 0644]
libstdc++-v3/libmath/csinhf.c [new file with mode: 0644]
libstdc++-v3/libmath/csinhl.c [new file with mode: 0644]
libstdc++-v3/libmath/csinl.c [new file with mode: 0644]
libstdc++-v3/libmath/csqrt.c [new file with mode: 0644]
libstdc++-v3/libmath/csqrtf.c [new file with mode: 0644]
libstdc++-v3/libmath/csqrtl.c [new file with mode: 0644]
libstdc++-v3/libmath/ctan.c [new file with mode: 0644]
libstdc++-v3/libmath/ctanf.c [new file with mode: 0644]
libstdc++-v3/libmath/ctanh.c [new file with mode: 0644]
libstdc++-v3/libmath/ctanhf.c [new file with mode: 0644]
libstdc++-v3/libmath/ctanhl.c [new file with mode: 0644]
libstdc++-v3/libmath/ctanl.c [new file with mode: 0644]
libstdc++-v3/libmath/expf.c [new file with mode: 0644]
libstdc++-v3/libmath/hypot.c [new file with mode: 0644]
libstdc++-v3/libmath/hypotf.c [new file with mode: 0644]
libstdc++-v3/libmath/hypotl.c [new file with mode: 0644]
libstdc++-v3/libmath/mathconf.h [new file with mode: 0644]
libstdc++-v3/libmath/nan.c [new file with mode: 0644]
libstdc++-v3/libmath/signbit.c [new file with mode: 0644]
libstdc++-v3/libmath/signbitf.c [new file with mode: 0644]
libstdc++-v3/libmath/signbitl.c [new file with mode: 0644]

diff --git a/libstdc++-v3/libmath/Makefile.am b/libstdc++-v3/libmath/Makefile.am
new file mode 100644 (file)
index 0000000..0421f96
--- /dev/null
@@ -0,0 +1,63 @@
+## Makefile for the math subdirectory of the GNU C++ Standard library.
+##
+## Copyright (C) 1997, 1998, 1999, 2000 Cygnus Solutions
+##
+## This file is part of the libstdc++ version 3 distribution.
+## Process this file with automake to produce Makefile.in.
+
+## This file is part of the GNU ISO C++ Library.  This library is free
+## software; you can redistribute it and/or modify it under the
+## terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This 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 General Public License for more details.
+
+## You should have received a copy of the GNU General Public License along
+## with this library; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+## USA.
+
+AUTOMAKE_OPTIONS = 1.3 cygnus
+
+noinst_LTLIBRARIES = libmath.la
+
+EXTRA_LONG_DOUBLE_yes = \
+       ccosl.c cexpl.c c_logl.c clog10l.c cpowl.c csinhl.c \
+       csqrtl.c ctanhl.c ctanl.c cargl.c hypotl.c \
+       signbitl.c cabsl.c 
+
+EXTRA_DIST = \
+       ccos.c ccosf.c ccosh.c ccoshf.c ccoshl.c \
+       cexp.c cexpf.c c_log.c c_logf.c  clog10.c clog10f.c \
+       cpow.c cpowf.c csin.c csinf.c csinh.c csinhf.c \
+       csinl.c csqrt.c csqrtf.c  ctan.c ctanf.c ctanh.c \
+       ctanhf.c  carg.c cargf.c hypot.c hypotf.c\
+       atan2f.c expf.c \
+       $(EXTRA_LONG_DOUBLE_yes) 
+
+libmath_la_LIBADD = \
+       @LIBMATHOBJS@ \
+       $(EXTRA_LONG_DOUBLE_$(USE_COMPLEX_LONG_DOUBLE)) 
+
+libmath_la_DEPENDENCIES = $(libmath_la_LIBADD)
+
+libmath_la_SOURCES = \
+       signbit.c signbitf.c cabs.c cabsf.c 
+
+LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+
+TOPLEVEL_INCLUDES = -I$(includedir)
+INCLUDES = -I../include  $(TOPLEVEL_INCLUDES)
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/libmath/Makefile.in b/libstdc++-v3/libmath/Makefile.in
new file mode 100644 (file)
index 0000000..2d0944f
--- /dev/null
@@ -0,0 +1,350 @@
+# 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@
+CC = @CC@
+CPP = @CPP@
+CPU_FLAGS = @CPU_FLAGS@
+CSHADOWFLAGS = @CSHADOWFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DEBUG_FLAGS = @DEBUG_FLAGS@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
+GCC_OBJDIR = @GCC_OBJDIR@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
+GLIBCPP_CFLAGS = @GLIBCPP_CFLAGS@
+GLIBCPP_CXXFLAGS = @GLIBCPP_CXXFLAGS@
+LIBMATHOBJS = @LIBMATHOBJS@
+LIBSTRINGOBJS = @LIBSTRINGOBJS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPT_LDFLAGS = @OPT_LDFLAGS@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+SECTION_FLAGS = @SECTION_FLAGS@
+SECTION_LDFLAGS = @SECTION_LDFLAGS@
+STRIP = @STRIP@
+THREADDEPS = @THREADDEPS@
+THREADINCS = @THREADINCS@
+THREADLIBS = @THREADLIBS@
+THREADOBJS = @THREADOBJS@
+THREADSPEC = @THREADSPEC@
+USE_COMPLEX_LONG_DOUBLE = @USE_COMPLEX_LONG_DOUBLE@
+VERSION = @VERSION@
+WERROR = @WERROR@
+WFMT_FLAGS = @WFMT_FLAGS@
+cpu_include_dir = @cpu_include_dir@
+ctype_include_dir = @ctype_include_dir@
+glibcpp_basedir = @glibcpp_basedir@
+ifGNUmake = @ifGNUmake@
+libinst_wstring_la = @libinst_wstring_la@
+
+AUTOMAKE_OPTIONS = 1.3 cygnus
+
+noinst_LTLIBRARIES = libmath.la
+
+EXTRA_LONG_DOUBLE_yes =        ccosl.c cexpl.c c_logl.c clog10l.c cpowl.c csinhl.c     csqrtl.c ctanhl.c ctanl.c cargl.c hypotl.c      signbitl.c cabsl.c 
+
+
+EXTRA_DIST =   ccos.c ccosf.c ccosh.c ccoshf.c ccoshl.c        cexp.c cexpf.c c_log.c c_logf.c  clog10.c clog10f.c     cpow.c cpowf.c csin.c csinf.c csinh.c csinhf.c  csinl.c csqrt.c csqrtf.c  ctan.c ctanf.c ctanh.c        ctanhf.c  carg.c cargf.c hypot.c hypotf.c       atan2f.c expf.c         $(EXTRA_LONG_DOUBLE_yes) 
+
+
+libmath_la_LIBADD =    @LIBMATHOBJS@   $(EXTRA_LONG_DOUBLE_$(USE_COMPLEX_LONG_DOUBLE)) 
+
+
+libmath_la_DEPENDENCIES = $(libmath_la_LIBADD)
+
+libmath_la_SOURCES =   signbit.c signbitf.c cabs.c cabsf.c 
+
+
+LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+
+TOPLEVEL_INCLUDES = -I$(includedir)
+INCLUDES = -I../include  $(TOPLEVEL_INCLUDES)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES = 
+LTLIBRARIES =  $(noinst_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libmath_la_LDFLAGS = 
+libmath_la_OBJECTS =  signbit.lo signbitf.lo cabs.lo cabsf.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)
+DIST_COMMON =  Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+SOURCES = $(libmath_la_SOURCES)
+OBJECTS = $(libmath_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) 
+       cd $(top_srcdir) && $(AUTOMAKE) --cygnus libmath/Makefile
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
+       cd $(top_builddir) \
+         && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-noinstLTLIBRARIES:
+
+clean-noinstLTLIBRARIES:
+       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+
+distclean-noinstLTLIBRARIES:
+
+maintainer-clean-noinstLTLIBRARIES:
+
+.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:
+
+libmath.la: $(libmath_la_OBJECTS) $(libmath_la_DEPENDENCIES)
+       $(LINK)  $(libmath_la_LDFLAGS) $(libmath_la_OBJECTS) $(libmath_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 = libmath
+
+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 $(LTLIBRARIES)
+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-noinstLTLIBRARIES mostlyclean-compile \
+               mostlyclean-libtool mostlyclean-tags \
+               mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-noinstLTLIBRARIES clean-compile clean-libtool \
+               clean-tags clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am:  distclean-noinstLTLIBRARIES distclean-compile \
+               distclean-libtool distclean-tags distclean-generic \
+               clean-am
+       -rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-noinstLTLIBRARIES \
+               maintainer-clean-compile maintainer-clean-libtool \
+               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-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \
+clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+clean-libtool maintainer-clean-libtool 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
+
+
+# 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/libstdc++-v3/libmath/atan2f.c b/libstdc++-v3/libmath/atan2f.c
new file mode 100644 (file)
index 0000000..1c59dae
--- /dev/null
@@ -0,0 +1,39 @@
+/* Compute arc tangent.  */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+float
+atan2f (float x, float y)
+{
+  /* We use the double version.  */
+  return atan2 (x, y);
+}
diff --git a/libstdc++-v3/libmath/c_log.c b/libstdc++-v3/libmath/c_log.c
new file mode 100644 (file)
index 0000000..c3b8c55
--- /dev/null
@@ -0,0 +1,63 @@
+/* Compute complex natural logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+__complex__ double
+c_log (__complex__ double x)
+{
+  __complex__ double result;
+
+  if (x == 0.0)
+    {
+      /* 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 (__real__ x == __real__ x && __imag__ x == __imag__ x)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = log (hypot (__real__ x, __imag__ x));
+      __imag__ result = atan2 (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = NAN;
+      if (INFINITE_P (__real__ x) || INFINITE_P (__imag__ x))
+       /* Real or imaginary part is infinite.  */
+       __real__ result = HUGE_VAL;
+      else
+       __real__ result = NAN;
+    }
+
+  return result;
+}
diff --git a/libstdc++-v3/libmath/c_logf.c b/libstdc++-v3/libmath/c_logf.c
new file mode 100644 (file)
index 0000000..aff2111
--- /dev/null
@@ -0,0 +1,64 @@
+/* Compute complex natural logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+c_logf (__complex__ float x)
+{
+  __complex__ float result;
+
+  if (x == 0.0)
+    {
+      /* 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 (__real__ x == __real__ x && __imag__ x == __imag__ x)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = logf (hypotf (__real__ x, __imag__ x));
+      __imag__ result = atan2f (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = NAN;
+      if (INFINITEF_P (__real__ x) || INFINITEF_P (__imag__ x))
+       /* Real or imaginary part is infinite.  */
+       __real__ result = HUGE_VALF;
+      else
+       __real__ result = NAN;
+    }
+
+  return result;
+}
diff --git a/libstdc++-v3/libmath/c_logl.c b/libstdc++-v3/libmath/c_logl.c
new file mode 100644 (file)
index 0000000..d4075f7
--- /dev/null
@@ -0,0 +1,75 @@
+/* Compute complex natural logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <math.h>
+#include "mathconf.h"
+#ifndef M_PIl
+#define M_PIl M_PI
+#endif
+
+/* Thanks to SGI we have to trick here.  At least Irix 6.2 provides hypotl,
+   but it has a wrong prototype.  Grrr.  */
+extern long double local_hypotl (long double, long double) asm ("hypotl");
+
+
+__complex__ long double
+c_logl (__complex__ long double x)
+{
+  __complex__ long double result;
+
+  if (x == 0.0)
+    {
+      /* 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 (__real__ x == __real__ x && __imag__ x == __imag__ x)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = logl (local_hypotl (__real__ x, __imag__ x));
+      __imag__ result = atan2l (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = NAN;
+      if (INFINITEL_P (__real__ x) || INFINITEL_P (__imag__ x))
+       /* Real or imaginary part is infinite.  */
+       __real__ result = HUGE_VALL;
+      else
+       __real__ result = NAN;
+    }
+
+  return result;
+}
diff --git a/libstdc++-v3/libmath/cabs.c b/libstdc++-v3/libmath/cabs.c
new file mode 100644 (file)
index 0000000..f2f41e2
--- /dev/null
@@ -0,0 +1,38 @@
+/* Return the complex absolute value of double complex value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+double
+cabs (__complex__ double z)
+{
+  return hypot (__real__ z, __imag__ z);
+}
diff --git a/libstdc++-v3/libmath/cabsf.c b/libstdc++-v3/libmath/cabsf.c
new file mode 100644 (file)
index 0000000..53358cf
--- /dev/null
@@ -0,0 +1,38 @@
+/* Return the complex absolute value of double complex value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+float
+cabsf (__complex__ float z)
+{
+  return hypotf (__real__ z, __imag__ z);
+}
diff --git a/libstdc++-v3/libmath/cabsl.c b/libstdc++-v3/libmath/cabsl.c
new file mode 100644 (file)
index 0000000..4b36a3a
--- /dev/null
@@ -0,0 +1,42 @@
+/* Return the complex absolute value of double complex value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+/* Thanks to SGI we have to trick here.  At least Irix 6.2 provides hypotl,
+   but it has a wrong prototype.  Grrr.  */
+extern long double local_hypotl (long double, long double) asm ("hypotl");
+
+
+long double
+__mycabsl (__complex__ long double z)
+{
+  return local_hypotl (__real__ z, __imag__ z);
+}
diff --git a/libstdc++-v3/libmath/carg.c b/libstdc++-v3/libmath/carg.c
new file mode 100644 (file)
index 0000000..dff4a19
--- /dev/null
@@ -0,0 +1,37 @@
+/* Compute argument of complex double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+double
+carg (__complex__ double x)
+{
+  return atan2 (__imag__ x, __real__ x);
+}
diff --git a/libstdc++-v3/libmath/cargf.c b/libstdc++-v3/libmath/cargf.c
new file mode 100644 (file)
index 0000000..90a2f41
--- /dev/null
@@ -0,0 +1,38 @@
+/* Compute argument of complex float value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+float
+cargf (__complex__ float x)
+{
+  return atan2f (__imag__ x, __real__ x);
+}
diff --git a/libstdc++-v3/libmath/cargl.c b/libstdc++-v3/libmath/cargl.c
new file mode 100644 (file)
index 0000000..ede84a1
--- /dev/null
@@ -0,0 +1,38 @@
+/* Compute argument of complex long double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+long double
+cargl (__complex__ long double x)
+{
+  return atan2l (__imag__ x, __real__ x);
+}
diff --git a/libstdc++-v3/libmath/ccos.c b/libstdc++-v3/libmath/ccos.c
new file mode 100644 (file)
index 0000000..208c6e6
--- /dev/null
@@ -0,0 +1,68 @@
+/* Return cosine of complex double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+__complex__ double
+ccos (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (!FINITE_P (__real__ x) || __imag__ x != __imag__ x)
+    {
+      if (__real__ x == 0.0 || __imag__ x == 0.0)
+       {
+         __real__ res = NAN;
+         __imag__ res = 0.0;
+       }
+      else if (INFINITE_P (__imag__ x))
+       {
+         __real__ res = HUGE_VAL;
+         __imag__ res = NAN;
+       }
+      else
+       {
+         __real__ res = NAN;
+         __imag__ res = NAN;
+       }
+    }
+  else
+    {
+      __complex__ double y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      res = ccosh (y);
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/ccosf.c b/libstdc++-v3/libmath/ccosf.c
new file mode 100644 (file)
index 0000000..0cbf4a0
--- /dev/null
@@ -0,0 +1,68 @@
+/* Return cosine of complex float value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+__complex__ float
+ccosf (__complex__ float x)
+{
+  __complex__ float res;
+
+  if (!FINITEF_P (__real__ x) || __imag__ x != __imag__ x)
+    {
+      if (__real__ x == 0.0 || __imag__ x == 0.0)
+       {
+         __real__ res = NAN;
+         __imag__ res = 0.0;
+       }
+      else if (INFINITE_P (__imag__ x))
+       {
+         __real__ res = HUGE_VALF;
+         __imag__ res = NAN;
+       }
+      else
+       {
+         __real__ res = NAN;
+         __imag__ res = NAN;
+       }
+    }
+  else
+    {
+      __complex__ float y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      res = ccoshf (y);
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/ccosh.c b/libstdc++-v3/libmath/ccosh.c
new file mode 100644 (file)
index 0000000..79fe94e
--- /dev/null
@@ -0,0 +1,93 @@
+/* Complex cosine hyperbole function for double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+ccosh (__complex__ double x)
+{
+  __complex__ double retval;
+
+  if (FINITE_P (__real__ x))
+    {
+      /* Real part is finite.  */
+      if (FINITE_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         double sinh_val = sinh (__real__ x);
+         double cosh_val = cosh (__real__ x);
+         double sinix = sin (__imag__ x);
+         double cosix = cos (__imag__ x);
+
+         __real__ retval = cosh_val * cosix;
+         __imag__ retval = sinh_val * sinix;
+       }
+      else
+       {
+         __imag__ retval = __real__ x == 0.0 ? 0.0 : NAN;
+         __real__ retval = NAN + NAN;
+       }
+    }
+  else if (INFINITE_P (__real__ x))
+    {
+      /* Real part is infinite.  */
+      if (__imag__ x == 0.0)
+       {
+         /* Imaginary part is 0.0.  */
+         __real__ retval = HUGE_VAL;
+         __imag__ retval = __imag__ x * copysign (1.0, __real__ x);
+       }
+      else if (FINITE_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         double sinix = sin (__imag__ x);
+         double cosix = cos (__imag__ x);
+
+         __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;
+       }
+    }
+  else
+    {
+      __real__ retval = NAN;
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/ccoshf.c b/libstdc++-v3/libmath/ccoshf.c
new file mode 100644 (file)
index 0000000..51c5890
--- /dev/null
@@ -0,0 +1,92 @@
+/* Complex cosine hyperbole function for float. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+ccoshf (__complex__ float x)
+{
+  __complex__ float retval;
+
+  if (FINITEF_P (__real__ x))
+    {
+      /* Real part is finite.  */
+      if (FINITEF_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         float sinh_val = sinhf (__real__ x);
+         float cosh_val = coshf (__real__ x);
+         float sinix = sinf (__imag__ x);
+         float cosix = cosf (__imag__ x);
+
+         __real__ retval = cosh_val * cosix;
+         __imag__ retval = sinh_val * sinix;
+       }
+      else
+       {
+         __imag__ retval = __real__ x == 0.0 ? 0.0 : NAN;
+         __real__ retval = NAN;
+       }
+    }
+  else if (INFINITEF_P (__real__ x))
+    {
+      /* Real part is infinite.  */
+      if (__imag__ x == 0.0)
+       {
+         /* Imaginary part is 0.0.  */
+         __real__ retval = HUGE_VALF;
+         __imag__ retval = __imag__ x * copysignf (1.0, __real__ x);
+       }
+      else if (FINITEF_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         float sinix = sinf (__imag__ x);
+         float cosix = cosf (__imag__ x);
+
+         __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 = NAN + NAN;
+       }
+    }
+  else
+    {
+      __real__ retval = NAN;
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/ccoshl.c b/libstdc++-v3/libmath/ccoshl.c
new file mode 100644 (file)
index 0000000..7bb2dac
--- /dev/null
@@ -0,0 +1,92 @@
+/* Complex cosine hyperbole function for long double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+ccoshl (__complex__ long double x)
+{
+  __complex__ long double retval;
+
+  if (FINITEL_P (__real__ x))
+    {
+      /* Real part is finite.  */
+      if (FINITEL_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         long double sinh_val = sinhl (__real__ x);
+         long double cosh_val = coshl (__real__ x);
+         long double sinix = sinl (__imag__ x);
+         long double cosix = cosl (__imag__ x);
+
+         __real__ retval = cosh_val * cosix;
+         __imag__ retval = sinh_val * sinix;
+       }
+      else
+       {
+         __imag__ retval = __real__ x == 0.0 ? 0.0 : NAN;
+         __real__ retval = NAN + NAN;
+       }
+    }
+  else if (INFINITEL_P (__real__ x))
+    {
+      /* Real part is infinite.  */
+      if (__imag__ x == 0.0)
+       {
+         /* Imaginary part is 0.0.  */
+         __real__ retval = HUGE_VALL;
+         __imag__ retval = __imag__ x * copysignl (1.0, __real__ x);
+       }
+      else if (FINITEL_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         long double sinix = sinl (__imag__ x);
+         long double cosix = cosl (__imag__ x);
+
+         __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 = NAN + NAN;
+       }
+    }
+  else
+    {
+      __real__ retval = NAN;
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/ccosl.c b/libstdc++-v3/libmath/ccosl.c
new file mode 100644 (file)
index 0000000..6531476
--- /dev/null
@@ -0,0 +1,69 @@
+/* Return cosine of complex long double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+ccosl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (!FINITEL_P (__real__ x) || __imag__ x != __imag__ x)
+    {
+      if (__real__ x == 0.0 || __imag__ x == 0.0)
+       {
+         __real__ res = NAN;
+         __imag__ res = 0.0;
+       }
+      else if (INFINITEL_P (__imag__ x))
+       {
+         __real__ res = HUGE_VALL;
+         __imag__ res = NAN;
+       }
+      else
+       {
+         __real__ res = NAN;
+         __imag__ res = NAN;
+       }
+    }
+  else
+    {
+      __complex__ long double y;
+
+      __real__ y = -__imag__ x;
+      __imag__ y = __real__ x;
+
+      res = ccoshl (y);
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/cexp.c b/libstdc++-v3/libmath/cexp.c
new file mode 100644 (file)
index 0000000..210220b
--- /dev/null
@@ -0,0 +1,111 @@
+/* Return value of complex exponential function for double complex value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+cexp (__complex__ double x)
+{
+  __complex__ double retval;
+
+  if (FINITE_P (__real__ x))
+    {
+      /* Real part is finite.  */
+      if (FINITE_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         double exp_val = exp (__real__ x);
+         double sinix = sin (__imag__ x);
+         double cosix = cos (__imag__ x);
+
+         if (FINITE_P (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;
+       }
+    }
+  else if (INFINITE_P (__real__ x))
+    {
+      /* Real part is infinite.  */
+      if (FINITE_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
+
+         if (__imag__ x == 0.0)
+           {
+             /* Imaginary part is 0.0.  */
+             __real__ retval = value;
+             __imag__ retval = __imag__ x;
+           }
+         else
+           {
+             double sinix = sin (__imag__ x);
+             double cosix = cos (__imag__ x);
+
+             __real__ retval = copysign (value, cosix);
+             __imag__ retval = copysign (value, sinix);
+           }
+       }
+      else if (signbit (__real__ x) == 0)
+       {
+         __real__ retval = HUGE_VAL;
+         __imag__ retval = NAN;
+       }
+      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;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/cexpf.c b/libstdc++-v3/libmath/cexpf.c
new file mode 100644 (file)
index 0000000..0888cb7
--- /dev/null
@@ -0,0 +1,110 @@
+/* Return value of complex exponential function for float complex value. */
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+cexpf (__complex__ float x)
+{
+  __complex__ float retval;
+
+  if (FINITEF_P (__real__ x))
+    {
+      /* Real part is finite.  */
+      if (FINITEF_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         float exp_val = expf (__real__ x);
+         float sinix = sinf (__imag__ x);
+         float cosix = cosf (__imag__ x);
+
+         if (FINITEF_P (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 = NAN;
+         __imag__ retval = NAN;
+       }
+    }
+  else if (INFINITEF_P (__real__ x))
+    {
+      /* Real part is infinite.  */
+      if (FINITEF_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
+
+         if (__imag__ x == 0.0)
+           {
+             /* Imaginary part is 0.0.  */
+             __real__ retval = value;
+             __imag__ retval = __imag__ x;
+           }
+         else
+           {
+             float sinix = sinf (__imag__ x);
+             float cosix = cosf (__imag__ x);
+
+             __real__ retval = copysignf (value, cosix);
+             __imag__ retval = copysignf (value, sinix);
+           }
+       }
+      else if (signbit (__real__ x) == 0)
+       {
+         __real__ retval = HUGE_VALF;
+         __imag__ retval = NAN;
+       }
+      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 = NAN;
+      __imag__ retval = NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/cexpl.c b/libstdc++-v3/libmath/cexpl.c
new file mode 100644 (file)
index 0000000..83cb4db
--- /dev/null
@@ -0,0 +1,110 @@
+/* Return value of complex exp function for long double complex value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+cexpl (__complex__ long double x)
+{
+  __complex__ long double retval;
+
+  if (FINITEL_P (__real__ x))
+    {
+      /* Real part is finite.  */
+      if (FINITEL_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         long double exp_val = expl (__real__ x);
+         long double sinix = sinl (__imag__ x);
+         long double cosix = cosl (__imag__ x);
+
+         if (FINITEL_P (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 = NAN;
+         __imag__ retval = NAN;
+       }
+    }
+  else if (INFINITEL_P (__real__ x))
+    {
+      /* Real part is infinite.  */
+      if (FINITEL_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
+
+         if (__imag__ x == 0.0)
+           {
+             /* Imaginary part is 0.0.  */
+             __real__ retval = value;
+             __imag__ retval = __imag__ x;
+           }
+         else
+           {
+             long double sinix = sinl (__imag__ x);
+             long double cosix = cosl (__imag__ x);
+
+             __real__ retval = copysignl (value, cosix);
+             __imag__ retval = copysignl (value, sinix);
+           }
+       }
+      else if (signbit (__real__ x) == 0)
+       {
+         __real__ retval = HUGE_VALL;
+         __imag__ retval = NAN;
+       }
+      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 = NAN;
+      __imag__ retval = NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/clog10.c b/libstdc++-v3/libmath/clog10.c
new file mode 100644 (file)
index 0000000..e158a99
--- /dev/null
@@ -0,0 +1,65 @@
+/* Compute complex base 10 logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+clog10 (__complex__ double x)
+{
+  __complex__ double result;
+
+  if (x == 0.0)
+    {
+      /* 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 (__real__ x != __real__ x && __imag__ x != __imag__ x)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = log10 (hypot (__real__ x, __imag__ x));
+      __imag__ result = atan2 (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = NAN;
+      if (INFINITE_P (__real__ x) || INFINITE_P (__imag__ x))
+       /* Real or imaginary part is infinite.  */
+       __real__ result = HUGE_VAL;
+      else
+       __real__ result = NAN;
+    }
+
+  return result;
+}
diff --git a/libstdc++-v3/libmath/clog10f.c b/libstdc++-v3/libmath/clog10f.c
new file mode 100644 (file)
index 0000000..b241cec
--- /dev/null
@@ -0,0 +1,64 @@
+/* Compute complex base 10 logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+clog10f (__complex__ float x)
+{
+  __complex__ float result;
+
+  if (x == 0.0)
+    {
+      /* 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 (__real__ x == __real__ x && __imag__ x == __imag__ x)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = log10f (hypotf (__real__ x, __imag__ x));
+      __imag__ result = atan2f (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = NAN;
+      if (INFINITEF_P (__real__ x) || INFINITEF_P (__imag__ x))
+       /* Real or imaginary part is infinite.  */
+       __real__ result = HUGE_VALF;
+      else
+       __real__ result = NAN;
+    }
+
+  return result;
+}
diff --git a/libstdc++-v3/libmath/clog10l.c b/libstdc++-v3/libmath/clog10l.c
new file mode 100644 (file)
index 0000000..9cec8f8
--- /dev/null
@@ -0,0 +1,74 @@
+/* Compute complex natural logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <math.h>
+#include "mathconf.h"
+#ifndef M_PIl
+#define M_PIl M_PI
+#endif
+
+/* Thanks to SGI we have to trick here.  At least Irix 6.2 provides hypotl,
+   but it has a wrong prototype.  Grrr.  */
+extern long double local_hypotl (long double, long double) asm ("hypotl");
+
+
+__complex__ long double
+clog10l (__complex__ long double x)
+{
+  __complex__ long double result;
+
+  if (x == 0.0)
+    {
+      /* 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 (__real__ x == __real__ x && __imag__ x == __imag__ x)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = log10l (local_hypotl (__real__ x, __imag__ x));
+      __imag__ result = atan2l (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = NAN;
+      if (INFINITEL_P (__real__ x) || INFINITEL_P (__imag__ x))
+       /* Real or imaginary part is infinite.  */
+       __real__ result = HUGE_VALL;
+      else
+       __real__ result = NAN;
+    }
+
+  return result;
+}
diff --git a/libstdc++-v3/libmath/complex-stub.h b/libstdc++-v3/libmath/complex-stub.h
new file mode 100644 (file)
index 0000000..5028b2a
--- /dev/null
@@ -0,0 +1,86 @@
+
+/* Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+/* This is no header meant to be used in general.  It's simply here to
+   get libstdc++ compiled.  It should never be installed in an official
+   directory.  */
+
+#ifndef _COMPLEX_H
+#define _COMPLEX_H     1
+
+__complex__ double ccos (__complex__ double x);
+__complex__ float ccosf (__complex__ float x);
+__complex__ long double ccosl (__complex__ long double x);
+
+__complex__ double ccosh (__complex__ double x);
+__complex__ float ccoshf (__complex__ float x);
+__complex__ long double ccoshl (__complex__ long double x);
+
+__complex__ double cexp (__complex__ double x);
+__complex__ float cexpf (__complex__ float x);
+__complex__ long double cexpl (__complex__ long double x);
+
+__complex__ double clog10 (__complex__ double x);
+__complex__ float clog10f (__complex__ float x);
+__complex__ long double clog10l (__complex__ long double x);
+
+__complex__ double cpow (__complex__ double x, __complex__ double c);
+__complex__ float cpowf (__complex__ float x, __complex__ float c);
+__complex__ long double cpowl (__complex__ long double x, __complex__ long double c);
+
+__complex__ double csin (__complex__ double x);
+__complex__ float csinf (__complex__ float x);
+__complex__ long double csinl (__complex__ long double x);
+
+__complex__ double csinh (__complex__ double x);
+__complex__ float csinhf (__complex__ float x);
+__complex__ long double csinhl (__complex__ long double x);
+
+__complex__ double csqrt (__complex__ double x);
+__complex__ float csqrtf (__complex__ float x);
+__complex__ long double csqrtl (__complex__ long double x);
+
+__complex__ double ctan (__complex__ double x);
+__complex__ float ctanf (__complex__ float x);
+__complex__ long double ctanl (__complex__ long double x);
+
+__complex__ double ctanh (__complex__ double x);
+__complex__ float ctanhf (__complex__ float x);
+__complex__ long double ctanhl (__complex__ long double x);
+
+double carg (__complex__ double x);
+float cargf (__complex__ float x);
+long double cargl (__complex__ long double x);
+
+double cabs (__complex__ double x);
+float cabsf (__complex__ float x);
+long double cabsl (__complex__ long double x);
+
+#endif
+
diff --git a/libstdc++-v3/libmath/copysignf.c b/libstdc++-v3/libmath/copysignf.c
new file mode 100644 (file)
index 0000000..968c147
--- /dev/null
@@ -0,0 +1,39 @@
+/* Copy sign of one number to another.  */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+float
+copysignf (float x, float y)
+{
+  /* We use the double version.  */
+  return copysign (x, y);
+}
diff --git a/libstdc++-v3/libmath/cpow.c b/libstdc++-v3/libmath/cpow.c
new file mode 100644 (file)
index 0000000..5d816a1
--- /dev/null
@@ -0,0 +1,39 @@
+/* Complex power of double values. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+cpow (__complex__ double x, __complex__ double c)
+{
+  return cexp (c * c_log (x));
+}
diff --git a/libstdc++-v3/libmath/cpowf.c b/libstdc++-v3/libmath/cpowf.c
new file mode 100644 (file)
index 0000000..d4aa590
--- /dev/null
@@ -0,0 +1,38 @@
+/* Complex power of float values. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+cpowf (__complex__ float x, __complex__ float c)
+{
+  return cexpf (c * c_logf (x));
+}
diff --git a/libstdc++-v3/libmath/cpowl.c b/libstdc++-v3/libmath/cpowl.c
new file mode 100644 (file)
index 0000000..65856d4
--- /dev/null
@@ -0,0 +1,40 @@
+/* Complex power of long double values. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+__complex__ long double
+cpowl (__complex__ long double x, __complex__ long double c)
+{
+  return cexpl (c * c_logl (x));
+}
+
+
+
diff --git a/libstdc++-v3/libmath/csin.c b/libstdc++-v3/libmath/csin.c
new file mode 100644 (file)
index 0000000..bde6019
--- /dev/null
@@ -0,0 +1,115 @@
+/* Complex sine function for double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+csin (__complex__ double x)
+{
+  __complex__ double retval;
+  int negate = signbit (__real__ x);
+
+  __real__ x = fabs (__real__ x);
+
+  if (FINITE_P (__imag__ x))
+    {
+      /* Imaginary part is finite.  */
+      if (FINITE_P (__real__ x))
+       {
+         /* Real part is finite.  */
+         double sinh_val = sinh (__imag__ x);
+         double cosh_val = cosh (__imag__ x);
+         double sinix = sin (__real__ x);
+         double cosix = cos (__real__ x);
+
+         __real__ retval = cosh_val * sinix;
+         __imag__ retval = sinh_val * cosix;
+
+         if (negate)
+           __real__ retval = -__real__ retval;
+       }
+      else
+       {
+         if (__imag__ x == 0.0)
+           {
+             /* Imaginary part is 0.0.  */
+             __real__ retval = NAN;
+             __imag__ retval = __imag__ x;
+           }
+         else
+           {
+             __real__ retval = NAN;
+             __imag__ retval = NAN;
+           }
+       }
+    }
+  else if (INFINITE_P (__imag__ x))
+    {
+      /* Imaginary part is infinite.  */
+      if (__real__ x == 0.0)
+       {
+         /* Real part is 0.0.  */
+         __real__ retval = copysign (0.0, negate ? -1.0 : 1.0);
+         __imag__ retval = __imag__ x;
+       }
+      else if (FINITE_P (__real__ x))
+       {
+         /* Real part is finite.  */
+         double sinix = sin (__real__ x);
+         double cosix = cos (__real__ x);
+
+         __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;
+       }
+    }
+  else
+    {
+      if (__real__ x == 0.0)
+       __real__ retval = copysign (0.0, negate ? -1.0 : 1.0);
+      else
+       __real__ retval = NAN;
+      __imag__ retval = NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/csinf.c b/libstdc++-v3/libmath/csinf.c
new file mode 100644 (file)
index 0000000..8c66865
--- /dev/null
@@ -0,0 +1,115 @@
+/* Complex sine function for float. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+csinf (__complex__ float x)
+{
+  __complex__ float retval;
+  int negate = signbit (__real__ x);
+
+  __real__ x = fabsf (__real__ x);
+
+  if (FINITEF_P (__imag__ x))
+    {
+      /* Imaginary part is finite.  */
+      if (FINITEF_P (__real__ x))
+       {
+         /* Real part is finite.  */
+         float sinh_val = sinhf (__imag__ x);
+         float cosh_val = coshf (__imag__ x);
+         float sinix = sinf (__real__ x);
+         float cosix = cosf (__real__ x);
+
+         __real__ retval = cosh_val * sinix;
+         __imag__ retval = sinh_val * cosix;
+
+         if (negate)
+           __real__ retval = -__real__ retval;
+       }
+      else
+       {
+         if (__imag__ x == 0.0)
+           {
+             /* Imaginary part is 0.0.  */
+             __real__ retval = NAN;
+             __imag__ retval = __imag__ x;
+           }
+         else
+           {
+             __real__ retval = NAN;
+             __imag__ retval = NAN;
+           }
+       }
+    }
+  else if (INFINITEF_P (__imag__ x))
+    {
+      /* Imaginary part is infinite.  */
+      if (__real__ x == 0.0)
+       {
+         /* Real part is 0.0.  */
+         __real__ retval = copysignf (0.0, negate ? -1.0 : 1.0);
+         __imag__ retval = __imag__ x;
+       }
+      else if (FINITEF_P (__real__ x))
+       {
+         /* Real part is finite.  */
+         float sinix = sinf (__real__ x);
+         float cosix = cosf (__real__ x);
+
+         __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 = NAN;
+         __imag__ retval = HUGE_VALF;
+       }
+    }
+  else
+    {
+      if (__real__ x == 0.0)
+       __real__ retval = copysignf (0.0, negate ? -1.0 : 1.0);
+      else
+       __real__ retval = NAN;
+      __imag__ retval = NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/csinh.c b/libstdc++-v3/libmath/csinh.c
new file mode 100644 (file)
index 0000000..9da924b
--- /dev/null
@@ -0,0 +1,110 @@
+/* Complex sine hyperbole function for double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+csinh (__complex__ double x)
+{
+  __complex__ double retval;
+  int negate = signbit (__real__ x);
+
+  __real__ x = fabs (__real__ x);
+
+  if (FINITE_P (__real__ x))
+    {
+      /* Real part is finite.  */
+      if (FINITE_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         double sinh_val = sinh (__real__ x);
+         double cosh_val = cosh (__real__ x);
+         double sinix = sin (__imag__ x);
+         double cosix = cos (__imag__ x);
+
+         __real__ retval = sinh_val * cosix;
+         __imag__ retval = cosh_val * sinix;
+
+         if (negate)
+           __real__ retval = -__real__ retval;
+       }
+      else
+       {
+         if (__real__ x == 0.0)
+           {
+             /* Real part is 0.0.  */
+             __real__ retval = copysign (0.0, negate ? -1.0 : 1.0);
+             __imag__ retval = NAN + NAN;
+           }
+         else
+           {
+             __real__ retval = NAN;
+             __imag__ retval = NAN;
+           }
+       }
+    }
+  else if (INFINITE_P (__real__ x))
+    {
+      /* Real part is infinite.  */
+      if (__imag__ x == 0.0)
+       {
+         /* Imaginary part is 0.0.  */
+         __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
+         __imag__ retval = __imag__ x;
+       }
+      else if (FINITE_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         double sinix = sin (__imag__ x);
+         double cosix = cos (__imag__ x);
+
+         __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;
+       }
+    }
+  else
+    {
+      __real__ retval = NAN;
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/csinhf.c b/libstdc++-v3/libmath/csinhf.c
new file mode 100644 (file)
index 0000000..3aaf49a
--- /dev/null
@@ -0,0 +1,89 @@
+/* Complex sine hyperbole function for float.
+   Copyright (C) 1997,1998 Free Software Foundation, Inc.
+
+   This file is part of the libstdc++ version 3 distribution.
+
+   This software is a copyrighted work licensed under the terms of the
+   Cygnus libstdc++ license. Please consult the file LICENSE.STD for
+   details.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+csinhf (__complex__ float x)
+{
+  __complex__ float retval;
+  int negate = signbit (__real__ x);
+
+  __real__ x = fabsf (__real__ x);
+
+  if (FINITEF_P (__real__ x))
+    {
+      /* Real part is finite.  */
+      if (FINITEF_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         float sinh_val = sinhf (__real__ x);
+         float cosh_val = coshf (__real__ x);
+         float sinix = sin (__imag__ x);
+         float cosix = cos (__imag__ x);
+
+         __real__ retval = sinh_val * cosix;
+         __imag__ retval = cosh_val * sinix;
+
+         if (negate)
+           __real__ retval = -__real__ retval;
+       }
+      else
+       {
+         if (__real__ x == 0.0)
+           {
+             /* Real part is 0.0.  */
+             __real__ retval = copysignf (0.0, negate ? -1.0 : 1.0);
+             __imag__ retval = NAN + NAN;
+           }
+         else
+           {
+             __real__ retval = NAN;
+             __imag__ retval = NAN;
+           }
+       }
+    }
+  else if (INFINITEF_P (__real__ x))
+    {
+      /* Real part is infinite.  */
+      if (__imag__ x == 0.0)
+       {
+         /* Imaginary part is 0.0.  */
+         __real__ retval = negate ? -HUGE_VALF : HUGE_VALF;
+         __imag__ retval = __imag__ x;
+       }
+      else if (FINITEF_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         float sinix = sinf (__imag__ x);
+         float cosix = cosf (__imag__ x);
+
+         __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 = NAN + NAN;
+       }
+    }
+  else
+    {
+      __real__ retval = NAN;
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/csinhl.c b/libstdc++-v3/libmath/csinhl.c
new file mode 100644 (file)
index 0000000..efd45a2
--- /dev/null
@@ -0,0 +1,110 @@
+/* Complex sine hyperbole function for long double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+csinhl (__complex__ long double x)
+{
+  __complex__ long double retval;
+  int negate = signbit (__real__ x);
+
+  __real__ x = fabsl (__real__ x);
+
+  if (FINITEL_P (__real__ x))
+    {
+      /* Real part is finite.  */
+      if (FINITEL_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         long double sinh_val = sinhl (__real__ x);
+         long double cosh_val = coshl (__real__ x);
+         long double sinix = sinl (__imag__ x);
+         long double cosix = cosl (__imag__ x);
+
+         __real__ retval = sinh_val * cosix;
+         __imag__ retval = cosh_val * sinix;
+
+         if (negate)
+           __real__ retval = -__real__ retval;
+       }
+      else
+       {
+         if (__real__ x == 0.0)
+           {
+             /* Real part is 0.0.  */
+             __real__ retval = copysignl (0.0, negate ? -1.0 : 1.0);
+             __imag__ retval = NAN + NAN;
+           }
+         else
+           {
+             __real__ retval = NAN;
+             __imag__ retval = NAN;
+           }
+       }
+    }
+  else if (INFINITEL_P (__real__ x))
+    {
+      /* Real part is infinite.  */
+      if (__imag__ x == 0.0)
+       {
+         /* Imaginary part is 0.0.  */
+         __real__ retval = negate ? -HUGE_VALL : HUGE_VALL;
+         __imag__ retval = __imag__ x;
+       }
+      else if (FINITEL_P (__imag__ x))
+       {
+         /* Imaginary part is finite.  */
+         long double sinix = sinl (__imag__ x);
+         long double cosix = cosl (__imag__ x);
+
+         __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 = NAN + NAN;
+       }
+    }
+  else
+    {
+      __real__ retval = NAN;
+      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/csinl.c b/libstdc++-v3/libmath/csinl.c
new file mode 100644 (file)
index 0000000..423b459
--- /dev/null
@@ -0,0 +1,115 @@
+/* Complex sine function for long double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+csinl (__complex__ long double x)
+{
+  __complex__ long double retval;
+  int negate = signbit (__real__ x);
+
+  __real__ x = fabsl (__real__ x);
+
+  if (FINITEL_P (__imag__ x))
+    {
+      /* Imaginary part is finite.  */
+      if (FINITEL_P (__real__ x))
+       {
+         /* Real part is finite.  */
+         long double sinh_val = sinhl (__imag__ x);
+         long double cosh_val = coshl (__imag__ x);
+         long double sinix = sinl (__real__ x);
+         long double cosix = cosl (__real__ x);
+
+         __real__ retval = cosh_val * sinix;
+         __imag__ retval = sinh_val * cosix;
+
+         if (negate)
+           __real__ retval = -__real__ retval;
+       }
+      else
+       {
+         if (__imag__ x == 0.0)
+           {
+             /* Imaginary part is 0.0.  */
+             __real__ retval = NAN;
+             __imag__ retval = __imag__ x;
+           }
+         else
+           {
+             __real__ retval = NAN;
+             __imag__ retval = NAN;
+           }
+       }
+    }
+  else if (INFINITEL_P (__imag__ x))
+    {
+      /* Imaginary part is infinite.  */
+      if (__real__ x == 0.0)
+       {
+         /* Real part is 0.0.  */
+         __real__ retval = copysignl (0.0, negate ? -1.0 : 1.0);
+         __imag__ retval = __imag__ x;
+       }
+      else if (FINITEL_P (__real__ x))
+       {
+         /* Real part is finite.  */
+         long double sinix = sinl (__real__ x);
+         long double cosix = cosl (__real__ x);
+
+         __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 = NAN;
+         __imag__ retval = HUGE_VALL;
+       }
+    }
+  else
+    {
+      if (__real__ x == 0.0)
+       __real__ retval = copysignl (0.0, negate ? -1.0 : 1.0);
+      else
+       __real__ retval = NAN;
+      __imag__ retval = NAN;
+    }
+
+  return retval;
+}
diff --git a/libstdc++-v3/libmath/csqrt.c b/libstdc++-v3/libmath/csqrt.c
new file mode 100644 (file)
index 0000000..5355165
--- /dev/null
@@ -0,0 +1,110 @@
+/* Complex square root of double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+csqrt (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (!FINITE_P (__real__ x) || !FINITE_P (__imag__ x))
+    {
+      if (INFINITE_P (__imag__ x))
+       {
+         __real__ res = HUGE_VAL;
+         __imag__ res = __imag__ x;
+       }
+      else if (INFINITE_P (__real__ x))
+       {
+         if (__real__ x < 0.0)
+           {
+             __real__ res = __imag__ x != __imag__ x ? NAN : 0;
+             __imag__ res = copysign (HUGE_VAL, __imag__ x);
+           }
+         else
+           {
+             __real__ res = __real__ x;
+             __imag__ res = (__imag__ x != __imag__ x
+                             ? NAN : copysign (0.0, __imag__ x));
+           }
+       }
+      else
+       {
+         __real__ res = NAN;
+         __imag__ res = NAN;
+       }
+    }
+  else
+    {
+      if (__imag__ x == 0.0)
+       {
+         if (__real__ x < 0.0)
+           {
+             __real__ res = 0.0;
+             __imag__ res = copysign (sqrt (-__real__ x), __imag__ x);
+           }
+         else
+           {
+             __real__ res = fabs (sqrt (__real__ x));
+             __imag__ res = copysign (0.0, __imag__ x);
+           }
+       }
+      else if (__real__ x == 0.0)
+       {
+         double r = sqrt (0.5 * fabs (__imag__ x));
+
+         __real__ res = copysign (r, __imag__ x);
+         __imag__ res = r;
+       }
+      else
+       {
+         __complex__ double q;
+         double t, r;
+
+         if (fabs (__imag__ x) < 2.0e-4 * fabs (__real__ x))
+           t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
+         else
+           t = 0.5 * (hypot (__real__ x, __imag__ x) - __real__ x);
+
+         r = sqrt (t);
+
+         __real__ q = __imag__ x / (2.0 * r);
+         __imag__ q = r;
+
+         /* Heron iteration in complex arithmetic.  */
+         res = 0.5 * (q + q / x);
+       }
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/csqrtf.c b/libstdc++-v3/libmath/csqrtf.c
new file mode 100644 (file)
index 0000000..a239588
--- /dev/null
@@ -0,0 +1,110 @@
+/* Complex square root of float value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+csqrtf (__complex__ float x)
+{
+  __complex__ float res;
+
+  if (!FINITEF_P (__real__ x) || !FINITEF_P (__imag__ x))
+    {
+      if (INFINITEF_P (__imag__ x))
+       {
+         __real__ res = HUGE_VALF;
+         __imag__ res = __imag__ x;
+       }
+      else if (INFINITEF_P (__real__ x))
+       {
+         if (__real__ x < 0.0)
+           {
+             __real__ res = __imag__ x != __imag__ x ? NAN : 0;
+             __imag__ res = copysignf (HUGE_VALF, __imag__ x);
+           }
+         else
+           {
+             __real__ res = __real__ x;
+             __imag__ res = (__imag__ x != __imag__ x
+                             ? NAN : copysignf (0.0, __imag__ x));
+           }
+       }
+      else
+       {
+         __real__ res = NAN;
+         __imag__ res = NAN;
+       }
+    }
+  else
+    {
+      if (__imag__ x == 0.0)
+       {
+         if (__real__ x < 0.0)
+           {
+             __real__ res = 0.0;
+             __imag__ res = copysignf (sqrtf (-__real__ x), __imag__ x);
+           }
+         else
+           {
+             __real__ res = fabsf (sqrtf (__real__ x));
+             __imag__ res = copysignf (0.0, __imag__ x);
+           }
+       }
+      else if (__real__ x == 0.0)
+       {
+         float r = sqrtf (0.5 * fabsf (__imag__ x));
+
+         __real__ res = copysignf (r, __imag__ x);
+         __imag__ res = r;
+       }
+      else
+       {
+         __complex__ float q;
+         float t, r;
+
+         if (fabsf (__imag__ x) < 2.0e-4 * fabsf (__real__ x))
+           t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
+         else
+           t = 0.5 * (hypotf (__real__ x, __imag__ x) - __real__ x);
+
+         r = sqrtf (t);
+
+         __real__ q = __imag__ x / (2.0 * r);
+         __imag__ q = r;
+
+         /* Heron iteration in complex arithmetic.  */
+         res = 0.5 * (q + q / x);
+       }
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/csqrtl.c b/libstdc++-v3/libmath/csqrtl.c
new file mode 100644 (file)
index 0000000..d871a69
--- /dev/null
@@ -0,0 +1,114 @@
+/* Complex square root of long double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+/* Thanks to SGI we have to trick here.  At least Irix 6.2 provides hypotl,
+   but it has a wrong prototype.  Grrr.  */
+extern long double local_hypotl (long double, long double) asm ("hypotl");
+
+
+__complex__ long double
+csqrtl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (!FINITEL_P (__real__ x) || !FINITEL_P (__imag__ x))
+    {
+      if (INFINITEL_P (__imag__ x))
+       {
+         __real__ res = HUGE_VALL;
+         __imag__ res = __imag__ x;
+       }
+      else if (INFINITEL_P (__real__ x))
+       {
+         if (__real__ x < 0.0)
+           {
+             __real__ res = __imag__ x != __imag__ x ? NAN : 0;
+             __imag__ res = copysignl (HUGE_VALL, __imag__ x);
+           }
+         else
+           {
+             __real__ res = __real__ x;
+             __imag__ res = (__imag__ x != __imag__ x
+                             ? NAN : copysignl (0.0, __imag__ x));
+           }
+       }
+      else
+       {
+         __real__ res = NAN;
+         __imag__ res = NAN;
+       }
+    }
+  else
+    {
+      if (__imag__ x == 0.0)
+       {
+         if (__real__ x < 0.0)
+           {
+             __real__ res = 0.0;
+             __imag__ res = copysignl (sqrtl (-__real__ x), __imag__ x);
+           }
+         else
+           {
+             __real__ res = fabsl (sqrtl (__real__ x));
+             __imag__ res = copysignl (0.0, __imag__ x);
+           }
+       }
+      else if (__real__ x == 0.0)
+       {
+         long double r = sqrtl (0.5 * fabsl (__imag__ x));
+
+         __real__ res = copysignl (r, __imag__ x);
+         __imag__ res = r;
+       }
+      else
+       {
+         __complex__ long double q;
+         long double t, r;
+
+         if (fabsl (__imag__ x) < 2.0e-4 * fabsl (__real__ x))
+           t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
+         else
+           t = 0.5 * (local_hypotl (__real__ x, __imag__ x) - __real__ x);
+
+         r = sqrtl (t);
+
+         __real__ q = __imag__ x / (2.0 * r);
+         __imag__ q = r;
+
+         /* Heron iteration in complex arithmetic.  */
+         res = 0.5 * (q + q / x);
+       }
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/ctan.c b/libstdc++-v3/libmath/ctan.c
new file mode 100644 (file)
index 0000000..2a35c18
--- /dev/null
@@ -0,0 +1,70 @@
+/* Complex tangent function for double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+ctan (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (!FINITE_P (__real__ x) || !FINITE_P (__imag__ x))
+    {
+      if (INFINITE_P (__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;
+       }
+    }
+  else
+    {
+      double sin2rx = sin (2.0 * __real__ x);
+      double cos2rx = cos (2.0 * __real__ x);
+      double den;
+
+      den = cos2rx + cosh (2.0 * __imag__ x);
+
+      __real__ res = sin2rx / den;
+      __imag__ res = sinh (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/ctanf.c b/libstdc++-v3/libmath/ctanf.c
new file mode 100644 (file)
index 0000000..ebd8cfa
--- /dev/null
@@ -0,0 +1,70 @@
+/* Complex tangent function for float. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+ctanf (__complex__ float x)
+{
+  __complex__ float res;
+
+  if (!FINITEF_P (__real__ x) || !FINITEF_P (__imag__ x))
+    {
+      if (INFINITEF_P (__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 = NAN;
+         __imag__ res = NAN;
+       }
+    }
+  else
+    {
+      float sin2rx = sinf (2.0f * __real__ x);
+      float cos2rx = cosf (2.0f * __real__ x);
+      float den;
+
+      den = cos2rx + coshf (2.0 * __imag__ x);
+
+      __real__ res = sin2rx / den;
+      __imag__ res = sinhf (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/ctanh.c b/libstdc++-v3/libmath/ctanh.c
new file mode 100644 (file)
index 0000000..5db5cd6
--- /dev/null
@@ -0,0 +1,70 @@
+/* Complex hyperbole tangent for double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+ctanh (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (!FINITE_P (__real__ x) || !FINITE_P (__imag__ x))
+    {
+      if (INFINITE_P (__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;
+       }
+    }
+  else
+    {
+      double sin2ix = sin (2.0 * __imag__ x);
+      double cos2ix = cos (2.0 * __imag__ x);
+      double den;
+
+      den = (cosh (2.0 * __real__ x) + cos2ix);
+
+      __real__ res = sinh (2.0 * __real__ x) / den;
+      __imag__ res = sin2ix / den;
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/ctanhf.c b/libstdc++-v3/libmath/ctanhf.c
new file mode 100644 (file)
index 0000000..b5f1cce
--- /dev/null
@@ -0,0 +1,70 @@
+/* Complex hyperbole tangent for float. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+ctanhf (__complex__ float x)
+{
+  __complex__ float res;
+
+  if (!FINITEF_P (__real__ x) || !FINITEF_P (__imag__ x))
+    {
+      if (INFINITEF_P (__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 = NAN;
+         __imag__ res = NAN;
+       }
+    }
+  else
+    {
+      float sin2ix = sinf (2.0f * __imag__ x);
+      float cos2ix = cosf (2.0f * __imag__ x);
+      float den;
+
+      den = (coshf (2.0 * __real__ x) + cos2ix);
+
+      __real__ res = sinhf (2.0 * __real__ x) / den;
+      __imag__ res = sin2ix / den;
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/ctanhl.c b/libstdc++-v3/libmath/ctanhl.c
new file mode 100644 (file)
index 0000000..3fdf1fc
--- /dev/null
@@ -0,0 +1,70 @@
+/* Complex hyperbole tangent for long double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+ctanhl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (!FINITEL_P (__real__ x) || !FINITEL_P (__imag__ x))
+    {
+      if (INFINITEL_P (__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 = NAN;
+         __imag__ res = NAN;
+       }
+    }
+  else
+    {
+      long double sin2ix = sinl (2.0 * __imag__ x);
+      long double cos2ix = cosl (2.0 * __imag__ x);
+      long double den;
+
+      den = (coshl (2.0 * __real__ x) + cos2ix);
+
+      __real__ res = sinhl (2.0 * __real__ x) / den;
+      __imag__ res = sin2ix / den;
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/ctanl.c b/libstdc++-v3/libmath/ctanl.c
new file mode 100644 (file)
index 0000000..0af4cec
--- /dev/null
@@ -0,0 +1,69 @@
+/* Complex tangent function for long double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+ctanl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (!FINITEL_P (__real__ x) || !FINITEL_P (__imag__ x))
+    {
+      if (INFINITEL_P (__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 = NAN;
+         __imag__ res = NAN;
+       }
+    }
+  else
+    {
+      long double sin2rx = sinl (2.0 * __real__ x);
+      long double cos2rx = cosl (2.0 * __real__ x);
+      long double den;
+
+      den = cos2rx + coshl (2.0 * __imag__ x);
+
+      __real__ res = sin2rx / den;
+      __imag__ res = sinhl (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
diff --git a/libstdc++-v3/libmath/expf.c b/libstdc++-v3/libmath/expf.c
new file mode 100644 (file)
index 0000000..a597502
--- /dev/null
@@ -0,0 +1,39 @@
+/* Compute exponential function.  */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+float
+expf (float x)
+{
+  /* We use the double version.  */
+  return exp (x);
+}
diff --git a/libstdc++-v3/libmath/hypot.c b/libstdc++-v3/libmath/hypot.c
new file mode 100644 (file)
index 0000000..9e3c07b
--- /dev/null
@@ -0,0 +1,38 @@
+/* Compute hypothenuse. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+/* If the platform is so pathetic that is has no hypot function it does
+   not deserve it better than getting this version.  */
+extern double sqrt (double);
+
+double
+hypot (double x, double y)
+{
+  return sqrt (x * x + y * y);
+}
diff --git a/libstdc++-v3/libmath/hypotf.c b/libstdc++-v3/libmath/hypotf.c
new file mode 100644 (file)
index 0000000..29d1681
--- /dev/null
@@ -0,0 +1,48 @@
+/* Compute hypothenuse. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <config.h>
+
+/* If there is a `double' version use it.  Otherwise make it simply and
+   stupid.  */
+extern double hypot (double, double);
+extern double sqrt (double);
+extern float sqrtf (float);
+
+float
+hypotf (float x, float y)
+{
+#ifdef HAVE_HYPOT
+  return hypot (x, y);
+#elif HAVE_SQRTF
+  return sqrtf (x * x + y * y);
+#else
+  return sqrt (x * x + y * y);
+#endif
+}
diff --git a/libstdc++-v3/libmath/hypotl.c b/libstdc++-v3/libmath/hypotl.c
new file mode 100644 (file)
index 0000000..1ec8a9c
--- /dev/null
@@ -0,0 +1,37 @@
+/* Compute hypothenuse. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+/* The platform supports some long double functions but not hypotl.  Blarg.  */
+extern long double sqrtl (long double);
+
+long double
+hypotl (long double x, long double y)
+{
+  return sqrtl (x * x + y * y);
+}
diff --git a/libstdc++-v3/libmath/mathconf.h b/libstdc++-v3/libmath/mathconf.h
new file mode 100644 (file)
index 0000000..3f4503c
--- /dev/null
@@ -0,0 +1,413 @@
+/* Configuration data for libmath subpart of libstdc++. */
+
+/* Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <bits/c++config.h>
+
+#ifdef _GLIBCPP_HAVE_ENDIAN_H
+# include <endian.h>
+#else
+# ifdef _GLIBCPP_HAVE_MACHINE_ENDIAN_H
+#  include <machine/endian.h>
+# else
+#  ifdef _GLIBCPP_HAVE_SYS_MACHINE_H
+#   include <sys/machine.h>
+#  else
+#   if defined _GLIBCPP_HAVE_SYS_ISA_DEFS_H || defined _GLIBCPP_HAVE_MACHINE_PARAM_H
+/* This is on Solaris.  */
+#    ifdef _GLIBCPP_HAVE_SYS_ISA_DEFS_H
+#     include <sys/isa_defs.h>
+#    endif
+#    ifdef _GLIBCPP_HAVE_MACHINE_PARAM_H
+#     include <machine/param.h>
+#    endif
+#    ifdef _LITTLE_ENDIAN
+#     define LITTLE_ENDIAN 1
+#    endif
+#    ifdef _BIG_ENDIAN
+#     define BIG_ENDIAN 1
+#    endif
+#    define BYTE_ORDER 1
+#   else
+/* We have to rely on the AC_C_BIGENDIAN test.  */
+#    ifdef WORDS_BIGENDIAN
+#     define BIG_ENDIAN 1
+#    else
+#     define LITTLE_ENDIAN 1
+#    endif
+#    define BYTE_ORDER 1
+#   endif
+#  endif
+# endif
+#endif
+
+typedef unsigned int U_int32_t __attribute ((mode (SI)));
+typedef int Int32_t __attribute ((mode (SI)));
+typedef unsigned int U_int64_t __attribute ((mode (DI)));
+typedef int Uint64_t __attribute ((mode (DI)));
+
+#ifdef _GLIBCPP_HAVE_NAN_H
+# include <nan.h>
+#endif
+
+#ifndef NAN
+# define NAN (nan())
+double nan (void);
+#endif
+
+#ifdef _GLIBCPP_HAVE_IEEEFP_H
+# include <ieeefp.h>
+#endif
+
+#ifdef _GLIBCPP_HAVE_FP_H
+# include <fp.h>
+#endif
+
+#ifdef _GLIBCPP_HAVE_FLOAT_H
+# include <float.h>
+#endif
+
+/* `float' variant of HUGE_VAL.  */
+#ifndef HUGE_VALF
+# ifdef HUGE_VALf
+#  define HUGE_VALF HUGE_VALf
+# else
+#  define HUGE_VALF HUGE_VAL
+# endif
+#endif
+
+/* `long double' variant of HUGE_VAL.  */
+#ifndef HUGE_VALL
+# ifdef HUGE_VALl
+#  define HUGE_VALL HUGE_VALl
+# else
+#  define HUGE_VALL HUGE_VAL
+# endif
+#endif
+
+/* Make sure that at least HUGE_VAL is defined.  */
+#ifndef HUGE_VAL
+# ifdef HUGE
+#  define HUGE_VAL HUGE
+# else
+#  ifdef MAXFLOAT
+#   define HUGE_VAL MAXFLOAT
+#  else
+#   error "We need HUGE_VAL!"
+#  endif
+# endif
+#endif
+
+#ifndef M_PI
+# define M_PI 3.14159265358979323846
+#endif
+
+/* Test whether number is finite.  */
+#ifdef isfinite
+/* This is an ISO C 9x function.  */
+# define FINITE_P(X) isfinite (X)
+# define FINITEF_P(X) isfinite (X)
+# define FINITEL_P(X) isfinite (X)
+#else
+# ifdef IsNANorINF
+/* This is for Solaris, which does not have special macros for other
+   types.  */
+#  define FINITE_P(X) (!IsNANorINF (X))
+#  define FINITEF_P(X) (!IsNANorINF (X))
+#  define FINITEL_P(X) (!IsNANorINF (X))
+# else
+#  if defined _GLIBCPP_HAVE_ISINF && defined _GLIBCPP_HAVE_ISNAN
+#   define FINITE_P(X) ({ double __x = (X); !isinf (__x) && !isnan (__x); })
+#  else
+#   ifdef _GLIBCPP_HAVE_FINITE
+#    define FINITE_P(X) finite (X)
+#   else
+#    error "We need FINITE_P"
+#   endif
+#  endif
+#  if defined _GLIBCPP_HAVE_ISINFF && defined _GLIBCPP_HAVE_ISNANF
+#   define FINITEF_P(X) ({ float __x = (X); !isinff (__x) && !isnanf (__x); })
+#  else
+#   ifdef _GLIBCPP_HAVE_FINITE
+#    define FINITEF_P(X) finite (X)
+#   else
+#    define FINITEF_P(X) FINITE_P (X)
+#   endif
+#  endif
+#  if defined _GLIBCPP_HAVE_ISINFL && defined _GLIBCPP_HAVE_ISNANL
+#   define FINITEL_P(X) ({ long double __x = (X); \
+                          !isinfl (__x) && !isnanl (__x); })
+#  else
+#   ifdef _GLIBCPP_HAVE_QFINITE
+#    define FINITEL_P(X) qfinite (X)
+#   else
+#    define FINITEL_P(X) FINITE_P (X)
+#   endif
+#  endif
+# endif
+#endif
+
+/* Test whether number is infinite.  */
+#ifdef isinf
+/* This is an ISO C 9x macro.  */
+# define INFINITE_P(X) isinf (X)
+# define INFINITEF_P(X) isinf (X)
+# define INFINITEL_P(X) isinf (X)
+#else
+# ifdef IsINF
+/* This is for Solaris, which does not have special macros for other
+   types.  */
+#  define INFINITE_P(X) IsINF (X)
+#  define INFINITEF_P(X) IsINF (X)
+#  define INFINITEL_P(X) IsINF (X)
+# else
+#  if defined _GLIBCPP_HAVE_ISINF
+#   define INFINITE_P(X) isinf (X)
+#  else
+#   ifdef _GLIBCPP_HAVE_FPCLASS
+#    ifdef _FPCLASS_PINF
+/* Mingw defines _FPCLASS_PINF.  */
+#     define FP_PINF _FPCLASS_PINF
+#    endif
+/* This is for Irix and Mingw.  */
+#    define INFINITE_P(X) (fpclass (fabs (X)) == FP_PINF)
+#   else
+#    ifdef IS_INF
+/* This is for AIX.  */
+#     define INFINITE_P(X) ({ double __d = (X); IS_INF (__d); })
+#    else
+#     error "We need INFINITE_P"
+#    endif
+#   endif
+#  endif
+#  if defined _GLIBCPP_HAVE_ISINFF
+#   define INFINITEF_P(X) isinff (X)
+#  else
+#   define INFINITEF_P(X) INFINITE_P (X)
+#  endif
+#  if defined _GLIBCPP_HAVE_ISINFL
+#   define INFINITEL_P(X) isinfl (X)
+#  else
+#   ifdef _GLIBCPP_HAVE_QFPCLASS
+#    define INFINITEL_P(X) (qfpclass (fabsl (X)) == FP_PINF)
+#   else
+#    define INFINITEL_P(X) INFINITE_P (X)
+#   endif
+#  endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _GLIBCPP_HAVE_COMPLEX_H
+# include <complex.h>
+#else
+# include "complex-stub.h"
+#endif
+__complex__ double c_log (__complex__ double x);
+__complex__ float c_logf (__complex__ float x);
+__complex__ long double c_logl (__complex__ long double x);
+
+/* signbit is a macro in ISO C 9x.  */
+#ifndef signbit
+extern int __signbitf (float);
+extern int __signbit (double);
+extern int __signbitl (long double);
+
+# define signbit(x) \
+     (sizeof (x) == sizeof (float) ?                                          \
+        __signbitf (x)                                                        \
+      : sizeof (x) == sizeof (double) ?                                       \
+        __signbit (x) : __signbitl (x))
+#endif
+
+#if BYTE_ORDER == BIG_ENDIAN
+typedef union
+{
+  double value;
+  struct
+  {
+    U_int32_t msw;
+    U_int32_t lsw;
+  } parts;
+} ieee_double_shape_type;
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN
+typedef union
+{
+  double value;
+  struct
+  {
+    U_int32_t lsw;
+    U_int32_t msw;
+  } parts;
+} ieee_double_shape_type;
+#endif
+/* 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)
+
+
+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)
+
+
+#if BYTE_ORDER == BIG_ENDIAN
+typedef union
+{
+  long double value;
+  struct
+  {
+    unsigned int sign_exponent:16;
+    unsigned int empty:16;
+    U_int32_t msw;
+    U_int32_t lsw;
+  } parts;
+} ieee_long_double_shape_type;
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN
+typedef union
+{
+  long double value;
+  struct
+  {
+    U_int32_t lsw;
+    U_int32_t msw;
+    unsigned int sign_exponent:16;
+    unsigned int empty:16;
+  } parts;
+} ieee_long_double_shape_type;
+#endif
+/* Get int from the exponent of a long double.  */
+#define GET_LDOUBLE_EXP(exp,d)                                  \
+do {                                                            \
+  ieee_long_double_shape_type ge_u;                             \
+  ge_u.value = (d);                                             \
+  (exp) = ge_u.parts.sign_exponent;                             \
+} while (0)
+
+#if BYTE_ORDER == BIG_ENDIAN
+typedef union
+{
+  long double value;
+  struct
+  {
+    U_int64_t msw;
+    U_int64_t lsw;
+  } parts64;
+  struct
+  {
+    U_int32_t w0, w1, w2, w3;
+  } parts32;
+} ieee_quad_double_shape_type;
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN
+typedef union
+{
+  long double value;
+  struct
+  {
+    U_int64_t lsw;
+    U_int64_t msw;
+  } parts64;
+  struct
+  {
+    U_int32_t w3, w2, w1, w0;
+  } parts32;
+} ieee_quad_double_shape_type;
+#endif
+/* Get most significant 64 bit int from a quad long double.  */
+#define GET_LDOUBLE_MSW64(msw,d)                               \
+do {                                                           \
+  ieee_quad_double_shape_type qw_u;                            \
+  qw_u.value = (d);                                            \
+  (ix0) = qw_u.parts64.msw;                                    \
+} while (0)
+        
+
+/* Replacement for non-existing float functions.  */
+#if !defined(_GLIBCPP_HAVE_FABSF) && !defined(_GLIBCPP_HAVE___BUILTIN_FABSF)
+# define fabsf(x) fabs (x)
+#endif
+#if !defined(_GLIBCPP_HAVE_COSF) && !defined(_GLIBCPP_HAVE___BUILTIN_COSF)
+# define cosf(x) cos (x)
+#endif
+#ifndef _GLIBCPP_HAVE_COSHF
+# define coshf(x) cosh (x)
+#endif
+#ifndef _GLIBCPP_HAVE_EXPF
+# define expf(x) expf (x)
+#endif
+#ifndef _GLIBCPP_HAVE_LOGF
+# define logf(x) log(x)
+#endif
+#ifndef _GLIBCPP_HAVE_LOG10F
+# define log10f(x) log10 (x)
+#endif
+#ifndef _GLIBCPP_HAVE_POWF
+# define powf(x, y) pow (x, y)
+#endif
+#if !defined(_GLIBCPP_HAVE_SINF) && !defined(_GLIBCPP_HAVE___BUILTIN_SINF)
+# define sinf(x) sin (x)
+#endif
+#ifndef _GLIBCPP_HAVE_SINHF
+# define sinhf(x) sinh (x)
+#endif
+#if !defined(_GLIBCPP_HAVE_SQRTF) && !defined(_GLIBCPP_HAVE___BUILTIN_SQRTF)
+# define sqrtf(x) sqrt (x)
+#endif
+#ifndef _GLIBCPP_HAVE_TANF
+# define tanf(x) tan (x)
+#endif
+#ifndef _GLIBCPP_HAVE_TANHF
+# define tanhf(x) tanh (x)
+#endif
+#ifndef _GLIBCPP_HAVE_STRTOF
+# define strtof(s, e) strtod (s, e)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/libstdc++-v3/libmath/nan.c b/libstdc++-v3/libmath/nan.c
new file mode 100644 (file)
index 0000000..779173a
--- /dev/null
@@ -0,0 +1,36 @@
+/* Return quiet nan. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <stdlib.h>
+#include <string.h>
+
+double
+nan ()
+{ return strtod ("nan", NULL); }
diff --git a/libstdc++-v3/libmath/signbit.c b/libstdc++-v3/libmath/signbit.c
new file mode 100644 (file)
index 0000000..0d58ed8
--- /dev/null
@@ -0,0 +1,41 @@
+/* Return nonzero value if number is negative. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+int
+__signbit (double x)
+{
+  Int32_t hx;
+
+  GET_HIGH_WORD (hx, x);
+  return hx & 0x80000000;
+}
diff --git a/libstdc++-v3/libmath/signbitf.c b/libstdc++-v3/libmath/signbitf.c
new file mode 100644 (file)
index 0000000..5e2eee1
--- /dev/null
@@ -0,0 +1,41 @@
+/* Return nonzero value if number is negative. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+int
+__signbitf (float x)
+{
+  Int32_t hx;
+
+  GET_FLOAT_WORD (hx, x);
+  return hx & 0x80000000;
+}
diff --git a/libstdc++-v3/libmath/signbitl.c b/libstdc++-v3/libmath/signbitl.c
new file mode 100644 (file)
index 0000000..3516f07
--- /dev/null
@@ -0,0 +1,48 @@
+/* Return nonzero value if number is negative. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU ISO C++ Library.  This library is free
+   software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this library; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.
+
+   As a special exception, you may use this file as part of a free software
+   library without restriction.  Specifically, if other files instantiate
+   templates or use macros or inline functions from this file, or you compile
+   this file and link it with other files to produce an executable, this
+   file does not by itself cause the resulting executable to be covered by
+   the GNU General Public License.  This exception does not however
+   invalidate any other reasons why the executable file might be covered by
+   the GNU General Public License.  */
+
+#include <float.h>
+#include <math.h>
+#include "mathconf.h"
+
+int
+__signbitl (long double x)
+{
+#if LDBL_MANT_DIG == 113
+  Int64_t msw;
+
+  GET_LDOUBLE_MSW64 (msw, x);
+  return msw < 0;
+#else
+  Int32_t e;
+
+  GET_LDOUBLE_EXP (e, x);
+  return e & 0x8000;
+#endif
+}
This page took 0.170164 seconds and 5 git commands to generate.