Commit 0ba2a514 by Gabriel Dos Reis Committed by Gabriel Dos Reis

Makefile.am (EXTRA_LONG_DOUBLE_yes): Remove ccosl, cexpl, clog10l, csinhl, ctanhl, ctanl.

	* libmath/Makefile.am (EXTRA_LONG_DOUBLE_yes): Remove ccosl,
	cexpl, clog10l, csinhl, ctanhl, ctanl.
	(EXTRA_DIST): Remove ccos, ccosf, csin, csinf, ccosh, ccoshf,
	csing, csinhf, clog10, clog10f, ctan, ctanf, ctanh, ctanhf.
	* libmath/Makefile.in: Regenarate.
	* libmath/ccos.c: Remove.
	* libmath/ccosf.c: Likewise.
	* libmath/ccosl.c: Likewise.
	* libmath/csin.c: Likewise.
	* libmath/csinf.c: Likewise.
	* libmath/csinl.c: Likewise.
	* libmath/ctan.c: Likewise.
	* libmath/ctanf.c: Likewise.
	* libmath/ctanl.c: Likewise.
	* libmath/ccosh.c: Likewise.
	* libmath/ccoshf.c: Likewise.
	* libmath/ccoshl.c: Likewise.
	* libmath/csinh.c: Likewise.
	* libmath/csinhf.c: Likewise.
	* libmath/csinhl.c: Likewise.
	* libmath/ctanh.c: Likewise.
	* libmath/ctanhf.c: Likewise.
	* libmath/ctanhl.c: Likewise.
	* libmath/cexp.c: Likewise.
	* libmath/cexpf.c: Likewise.
	* libmath/cexpl.c: Likewise.
	* libmath/clog10.c: Likewise.
	* libmath/clog10f.c: Likewise.
	* libmath/clog10l.c: Likewise.
	* libmath/complex-stub.h: Remove forward declaration of functions
	mentioned above.

	* include/bits/std_complex.h(tan, tanh): Define primary templates.
	(complex<>): Remove friend declarations for tan<> and tanh<>.
	* src/complex.cc(tan, tanh): Remove specializations.

	* acinclude.m4: Remove check for ccos, ccosf, ccosl, ccosh,
	ccoshf, ccoshl,	csin, csinf, csinl, csinh, csinhf, csinhl, cexp,
	cexpf, cexpl, ctan, ctanf, ctanl, ctanh, ctanhf, ctanhl.
	* aclocal.m4: Regenarate.
	* configure: Regenarate.

From-SVN: r38128
parent ecddf6a8
2000-12-08 Gabriel Dos Reis <gdr@codesourcery.com>
* libmath/Makefile.am (EXTRA_LONG_DOUBLE_yes): Remove ccosl,
cexpl, clog10l, csinhl, ctanhl, ctanl.
(EXTRA_DIST): Remove ccos, ccosf, csin, csinf, ccosh, ccoshf,
csing, csinhf, clog10, clog10f, ctan, ctanf, ctanh, ctanhf.
* libmath/Makefile.in: Regenarate.
* libmath/ccos.c: Remove.
* libmath/ccosf.c: Likewise.
* libmath/ccosl.c: Likewise.
* libmath/csin.c: Likewise.
* libmath/csinf.c: Likewise.
* libmath/csinl.c: Likewise.
* libmath/ctan.c: Likewise.
* libmath/ctanf.c: Likewise.
* libmath/ctanl.c: Likewise.
* libmath/ccosh.c: Likewise.
* libmath/ccoshf.c: Likewise.
* libmath/ccoshl.c: Likewise.
* libmath/csinh.c: Likewise.
* libmath/csinhf.c: Likewise.
* libmath/csinhl.c: Likewise.
* libmath/ctanh.c: Likewise.
* libmath/ctanhf.c: Likewise.
* libmath/ctanhl.c: Likewise.
* libmath/cexp.c: Likewise.
* libmath/cexpf.c: Likewise.
* libmath/cexpl.c: Likewise.
* libmath/clog10.c: Likewise.
* libmath/clog10f.c: Likewise.
* libmath/clog10l.c: Likewise.
* libmath/complex-stub.h: Remove forward declaration of functions
mentioned above.
* include/bits/std_complex.h(tan, tanh): Define primary templates.
(complex<>): Remove friend declarations for tan<> and tanh<>.
* src/complex.cc(tan, tanh): Remove specializations.
* acinclude.m4: Remove check for ccos, ccosf, ccosl, ccosh,
ccoshf, ccoshl, csin, csinf, csinl, csinh, csinhf, csinhl, cexp,
cexpf, cexpl, ctan, ctanf, ctanl, ctanh, ctanhf, ctanhl.
* aclocal.m4: Regenarate.
* configure: Regenarate.
2000-12-08 Gabriel Dos Reis <gdr@codesourcery.com>
* acinclude.m4: Don't forget to remove check for cpowl as it is no
longer needed, nor is the corresponding stub existent.
* aclocal.m4: Regenarate.
......
......@@ -754,9 +754,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
dnl Check for complex versions of math functions of platform.
AC_CHECK_HEADERS([complex.h])
AC_CHECK_LIB(m, main)
AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf \
csin csinf csinh csinhf csqrt \
csqrtf ctan ctanf ctanh ctanhf nan hypot hypotf atan2f expf \
AC_REPLACE_MATHFUNCS(csqrt csqrtf nan hypot hypotf atan2f expf \
copysignf)
dnl Compile the long double complex functions only if the function
......@@ -767,8 +765,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
if test x$ac_cv_func_atan2l = x"yes" \
&& test x$ac_cv_func_copysignl = x"yes"; then
USE_COMPLEX_LONG_DOUBLE=yes
AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl csinhl csinl \
csqrtl ctanhl ctanl hypotl signbitl clog10l)
AC_REPLACE_MATHFUNCS(csqrtl hypotl signbitl)
fi
AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
......
......@@ -766,9 +766,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
dnl Check for complex versions of math functions of platform.
AC_CHECK_HEADERS([complex.h])
AC_CHECK_LIB(m, main)
AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf \
csin csinf csinh csinhf csqrt \
csqrtf ctan ctanf ctanh ctanhf nan hypot hypotf atan2f expf \
AC_REPLACE_MATHFUNCS(csqrt csqrtf nan hypot hypotf atan2f expf \
copysignf)
dnl Compile the long double complex functions only if the function
......@@ -779,8 +777,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
if test x$ac_cv_func_atan2l = x"yes" \
&& test x$ac_cv_func_copysignl = x"yes"; then
USE_COMPLEX_LONG_DOUBLE=yes
AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl csinhl csinl \
csqrtl ctanhl ctanl hypotl signbitl clog10l)
AC_REPLACE_MATHFUNCS(csqrtl hypotl signbitl)
fi
AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
......
......@@ -452,6 +452,20 @@ namespace std
template<typename _Tp>
inline complex<_Tp>
tan(const complex<_Tp>& __z)
{
return sin(__z) / cos(__z);
}
template<typename _Tp>
inline complex<_Tp>
tanh(const complex<_Tp>& __z)
{
return sinh(__z) / cosh(__z);
}
template<typename _Tp>
inline complex<_Tp>
pow(const complex<_Tp>& __z, int __n)
{
return __pow_helper(__z, __n);
......@@ -525,8 +539,6 @@ namespace std
friend class complex<long double>;
friend complex<float> sqrt<>(const complex<float>&);
friend complex<float> tan<>(const complex<float>&);
friend complex<float> tanh<>(const complex<float>&);
};
inline float
......@@ -675,8 +687,6 @@ namespace std
friend class complex<long double>;
friend complex<double> sqrt<>(const complex<double>&);
friend complex<double> tan<>(const complex<double>&);
friend complex<double> tanh<>(const complex<double>&);
};
inline double
......@@ -825,8 +835,6 @@ namespace std
friend class complex<double>;
friend complex<long double> sqrt<>(const complex<long double>&);
friend complex<long double> tan<>(const complex<long double>&);
friend complex<long double> tanh<>(const complex<long double>&);
};
inline
......
......@@ -26,17 +26,10 @@ AUTOMAKE_OPTIONS = 1.3 cygnus
noinst_LTLIBRARIES = libmath.la
EXTRA_LONG_DOUBLE_yes = \
ccosl.c cexpl.c clog10l.c csinhl.c \
csqrtl.c ctanhl.c ctanl.c hypotl.c \
signbitl.c
csqrtl.c hypotl.c signbitl.c
EXTRA_DIST = \
ccos.c ccosf.c ccosh.c ccoshf.c ccoshl.c \
cexp.c cexpf.c clog10.c clog10f.c \
csin.c csinf.c csinh.c csinhf.c \
csinl.c csqrt.c csqrtf.c ctan.c ctanf.c ctanh.c \
ctanhf.c hypot.c hypotf.c\
atan2f.c expf.c \
csqrt.c csqrtf.c hypot.c hypotf.c atan2f.c expf.c \
$(EXTRA_LONG_DOUBLE_yes)
libmath_la_LIBADD = \
......
......@@ -113,31 +113,18 @@ AUTOMAKE_OPTIONS = 1.3 cygnus
noinst_LTLIBRARIES = libmath.la
EXTRA_LONG_DOUBLE_yes = \
ccosl.c cexpl.c clog10l.c csinhl.c \
csqrtl.c ctanhl.c ctanl.c hypotl.c \
signbitl.c
EXTRA_LONG_DOUBLE_yes = csqrtl.c hypotl.c signbitl.c
EXTRA_DIST = \
ccos.c ccosf.c ccosh.c ccoshf.c ccoshl.c \
cexp.c cexpf.c clog10.c clog10f.c \
csin.c csinf.c csinh.c csinhf.c \
csinl.c csqrt.c csqrtf.c ctan.c ctanf.c ctanh.c \
ctanhf.c hypot.c hypotf.c\
atan2f.c expf.c \
$(EXTRA_LONG_DOUBLE_yes)
EXTRA_DIST = csqrt.c csqrtf.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_LIBADD = @LIBMATHOBJS@ $(EXTRA_LONG_DOUBLE_$(USE_COMPLEX_LONG_DOUBLE))
libmath_la_DEPENDENCIES = $(libmath_la_LIBADD)
libmath_la_SOURCES = \
signbit.c signbitf.c
libmath_la_SOURCES = signbit.c signbitf.c
LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
......@@ -151,9 +138,7 @@ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
LIBIO_INCLUDES = @LIBIO_INCLUDES@
CSHADOW_INCLUDES = @CSHADOW_INCLUDES@
INCLUDES = \
-I$(GLIBCPP_INCLUDE_DIR) -I$(top_builddir)/include \
$(TOPLEVEL_INCLUDES)
INCLUDES = -I$(GLIBCPP_INCLUDE_DIR) -I$(top_builddir)/include $(TOPLEVEL_INCLUDES)
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_HEADER = ../config.h
......
/* 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;
}
......@@ -34,45 +34,9 @@
#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 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);
#endif
/* 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 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;
}
......@@ -48,15 +48,4 @@ namespace std
complex<FLT>
sqrt(const complex<FLT>& __x)
{ return complex<FLT>(csqrt(__x._M_value)); }
template<>
complex<FLT>
tan(const complex<FLT>& __x)
{ return complex<FLT>(ctan(__x._M_value)); }
template<>
complex<FLT>
tanh(const complex<FLT>& __x)
{ return complex<FLT>(ctanh(__x._M_value)); }
} // namespace std
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