Commit 20ad6051 by Benjamin Kosnik

Makefile.am: Remove OPTIMIZE_CXXFLAGS, WARN_CXXFLAGS, CONFIG_CXXFLAGS from here, and move to...


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: r36765
parent cc9711a3
## 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)
# 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 math/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 = math
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:
/* 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);
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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);
}
/* 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);
}
/* 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);
}
/* 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);
}
/* 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);
}
/* 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);
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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
/* 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);
}
/* 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));
}
/* 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));
}
/* 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));
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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);
}
/* 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);
}
/* 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
}
/* 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);
}
/* 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); }
/* 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;
}
/* 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;
}
/* 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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment