Commit 1409cd0b by Francois-Xavier Coudert Committed by François-Xavier Coudert

c99_protos.h: Add prototypes for C99 complex functions.

	* c99_protos.h: Add prototypes for C99 complex functions.
	* libgfortran.h: Include complex.h before c99_protos.h.
	* intrinsics/c99_functions.c: Define HAVE_ macros for the
	fallback functions we provide.
	(cabsf, cabs, cabsl, cargf, carg, cargl, cexpf, cexp, cexpl,
	clogf, clog, clogl, clog10f, clog10, clog10l, cpowf, cpow, cpowl,
	cqsrtf, csqrt, csqrtl, csinhf, csinh, csinhl, ccoshf, ccosh,
	ccoshl, ctanhf, ctanh, ctanhl, csinf, csin, csinl, ccosf, ccos,
	ccosl, ctanf, ctan, ctanl): New fallback functions.
	* Makefile.am (gfor_math_trig_c, gfor_math_trig_obj,
	gfor_specific_c, gfor_cmath_src, gfor_cmath_obj): Remove.
	* Makefile.in: Regenerate.
	* configure.ac: Remove checks for csin. Add checks for all C99
	complex functions.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* aclocal.m4: Regenerate.

From-SVN: r104626
parent 86ab6320
2005-09-25 Francois-Xavier Coudert <coudert@clipper.ens.fr> 2005-09-25 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* c99_protos.h: Add prototypes for C99 complex functions.
* libgfortran.h: Include complex.h before c99_protos.h.
* intrinsics/c99_functions.c: Define HAVE_ macros for the
fallback functions we provide.
(cabsf, cabs, cabsl, cargf, carg, cargl, cexpf, cexp, cexpl,
clogf, clog, clogl, clog10f, clog10, clog10l, cpowf, cpow, cpowl,
cqsrtf, csqrt, csqrtl, csinhf, csinh, csinhl, ccoshf, ccosh,
ccoshl, ctanhf, ctanh, ctanhl, csinf, csin, csinl, ccosf, ccos,
ccosl, ctanf, ctan, ctanl): New fallback functions.
* Makefile.am (gfor_math_trig_c, gfor_math_trig_obj,
gfor_specific_c, gfor_cmath_src, gfor_cmath_obj): Remove.
* Makefile.in: Regenerate.
* configure.ac: Remove checks for csin. Add checks for all C99
complex functions.
* config.h.in: Regenerate.
* configure: Regenerate.
* aclocal.m4: Regenerate.
2005-09-25 Francois-Xavier Coudert <coudert@clipper.ens.fr>
Danny Smith <dannysmith@users.sourceforge.net> Danny Smith <dannysmith@users.sourceforge.net>
PR libfortran/23803 PR libfortran/23803
......
...@@ -302,28 +302,6 @@ gfor_built_src= $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \ ...@@ -302,28 +302,6 @@ gfor_built_src= $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
$(i_pow_c) \ $(i_pow_c) \
selected_int_kind.inc selected_real_kind.inc kinds.h selected_int_kind.inc selected_real_kind.inc kinds.h
# We only use these if libm doesn't contain complex math functions.
gfor_math_trig_c= \
generated/trig_c4.c \
generated/trig_c8.c
gfor_math_exp_c= \
generated/exp_c4.c \
generated/exp_c8.c
gfor_math_hyp_c= \
generated/hyp_c4.c \
generated/hyp_c8.c
gfor_math_trig_obj= \
trig_c4.lo \
trig_c8.lo
gfor_math_exp_obj= \
exp_c4.lo \
exp_c8.lo
gfor_math_hyp_obj= \
hyp_c4.lo \
hyp_c8.lo
# Machine generated specifics # Machine generated specifics
gfor_built_specific_src= \ gfor_built_specific_src= \
generated/_abs_c4.f90 \ generated/_abs_c4.f90 \
...@@ -390,11 +368,6 @@ generated/_mod_i4.f90 \ ...@@ -390,11 +368,6 @@ generated/_mod_i4.f90 \
generated/_mod_i8.f90 \ generated/_mod_i8.f90 \
generated/_mod_r4.f90 \ generated/_mod_r4.f90 \
generated/_mod_r8.f90 generated/_mod_r8.f90
#specific intrinsics requiring manal code
#gfor_specific_c= \
intrinsics/_aimag.c \
intrinsics/_cabs.c \
foo
gfor_specific_src= \ gfor_specific_src= \
$(gfor_built_specific_src) \ $(gfor_built_specific_src) \
...@@ -402,20 +375,11 @@ $(gfor_built_specific2_src) \ ...@@ -402,20 +375,11 @@ $(gfor_built_specific2_src) \
intrinsics/dprod_r8.f90 \ intrinsics/dprod_r8.f90 \
intrinsics/f2c_specifics.F90 intrinsics/f2c_specifics.F90
gfor_cmath_src= $(gfor_math_trig_c) $(gfor_math_exp_c) $(gfor_math_hyp_c) BUILT_SOURCES=$(gfor_built_src) $(gfor_built_specific_src) \
gfor_cmath_obj= $(gfor_math_trig_obj) $(gfor_math_exp_obj) \
$(gfor_math_hyp_obj)
BUILT_SOURCES=$(gfor_built_src) $(gfor_cmath_src) $(gfor_built_specific_src) \
$(gfor_built_specific2_src) $(gfor_built_specific2_src)
libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \ libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \
$(gfor_helper_src) $(gfor_io_headers) $(gfor_specific_src) $(gfor_helper_src) $(gfor_io_headers) $(gfor_specific_src)
EXTRA_libgfortran_la_SOURCES = $(gfor_cmath_src)
libgfortran_la_LIBADD = @MATH_OBJ@
libgfortran_la_DEPENDENCIES = @MATH_OBJ@
I_M4_DEPS=m4/iparm.m4 I_M4_DEPS=m4/iparm.m4
I_M4_DEPS0=$(I_M4_DEPS) m4/iforeach.m4 I_M4_DEPS0=$(I_M4_DEPS) m4/iforeach.m4
I_M4_DEPS1=$(I_M4_DEPS) m4/ifunction.m4 I_M4_DEPS1=$(I_M4_DEPS) m4/ifunction.m4
...@@ -520,15 +484,6 @@ $(i_set_exponent_c): m4/set_exponent.m4 m4/mtype.m4 ...@@ -520,15 +484,6 @@ $(i_set_exponent_c): m4/set_exponent.m4 m4/mtype.m4
$(i_pow_c): m4/pow.m4 $(I_M4_DEPS) $(i_pow_c): m4/pow.m4 $(I_M4_DEPS)
m4 -Dfile=$@ -I$(srcdir)/m4 pow.m4 > $(srcdir)/$@ m4 -Dfile=$@ -I$(srcdir)/m4 pow.m4 > $(srcdir)/$@
$(gfor_math_trig_c): m4/ctrig.m4 m4/mtype.m4
m4 -Dfile=$@ -I$(srcdir)/m4 ctrig.m4 > $(srcdir)/$@
$(gfor_math_exp_c): m4/cexp.m4 m4/mtype.m4
m4 -Dfile=$@ -I$(srcdir)/m4 cexp.m4 > $(srcdir)/$@
$(gfor_math_hyp_c): m4/chyp.m4 m4/mtype.m4
m4 -Dfile=$@ -I$(srcdir)/m4 chyp.m4 > $(srcdir)/$@
$(gfor_built_specific_src): m4/specific.m4 m4/head.m4 $(gfor_built_specific_src): m4/specific.m4 m4/head.m4
m4 -Dfile=$@ -I$(srcdir)/m4 specific.m4 > $(srcdir)/$@ m4 -Dfile=$@ -I$(srcdir)/m4 specific.m4 > $(srcdir)/$@
......
# Makefile.in generated by automake 1.9.4 from Makefile.am. # Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc. # 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
@SET_MAKE@ @SET_MAKE@
SOURCES = $(libgfortran_la_SOURCES) $(EXTRA_libgfortran_la_SOURCES) $(libgfortranbegin_la_SOURCES)
srcdir = @srcdir@ srcdir = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
...@@ -67,6 +65,7 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; ...@@ -67,6 +65,7 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(toolexeclibdir)" am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
toolexeclibLTLIBRARIES_INSTALL = $(INSTALL) toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(toolexeclib_LTLIBRARIES) LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
libgfortran_la_LIBADD =
am__objects_1 = compile_options.lo environ.lo error.lo main.lo \ am__objects_1 = compile_options.lo environ.lo error.lo main.lo \
memory.lo pause.lo stop.lo string.lo select.lo memory.lo pause.lo stop.lo string.lo select.lo
am__objects_2 = all_l4.lo all_l8.lo am__objects_2 = all_l4.lo all_l8.lo
...@@ -174,7 +173,7 @@ LTPPFCCOMPILE = $(LIBTOOL) --mode=compile $(FC) $(DEFS) \ ...@@ -174,7 +173,7 @@ LTPPFCCOMPILE = $(LIBTOOL) --mode=compile $(FC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_FCFLAGS) $(FCFLAGS) $(AM_FCFLAGS) $(FCFLAGS)
FCLD = $(FC) FCLD = $(FC)
FCLINK = $(LIBTOOL) --mode=link $(FCLD) $(AM_FFLAGS) $(FCFLAGS) \ FCLINK = $(LIBTOOL) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@ $(AM_LDFLAGS) $(LDFLAGS) -o $@
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
...@@ -186,10 +185,9 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ ...@@ -186,10 +185,9 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@ $(AM_LDFLAGS) $(LDFLAGS) -o $@
FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS) FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
LTFCCOMPILE = $(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) LTFCCOMPILE = $(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
SOURCES = $(libgfortran_la_SOURCES) $(EXTRA_libgfortran_la_SOURCES) \ SOURCES = $(libgfortran_la_SOURCES) $(libgfortranbegin_la_SOURCES)
$(libgfortranbegin_la_SOURCES)
DIST_SOURCES = $(libgfortran_la_SOURCES) \ DIST_SOURCES = $(libgfortran_la_SOURCES) \
$(EXTRA_libgfortran_la_SOURCES) $(libgfortranbegin_la_SOURCES) $(libgfortranbegin_la_SOURCES)
MULTISRCTOP = MULTISRCTOP =
MULTIBUILDTOP = MULTIBUILDTOP =
MULTIDIRS = MULTIDIRS =
...@@ -245,7 +243,6 @@ MAINT = @MAINT@ ...@@ -245,7 +243,6 @@ MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MATH_OBJ = @MATH_OBJ@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
...@@ -597,32 +594,6 @@ gfor_built_src = $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \ ...@@ -597,32 +594,6 @@ gfor_built_src = $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
selected_int_kind.inc selected_real_kind.inc kinds.h selected_int_kind.inc selected_real_kind.inc kinds.h
# We only use these if libm doesn't contain complex math functions.
gfor_math_trig_c = \
generated/trig_c4.c \
generated/trig_c8.c
gfor_math_exp_c = \
generated/exp_c4.c \
generated/exp_c8.c
gfor_math_hyp_c = \
generated/hyp_c4.c \
generated/hyp_c8.c
gfor_math_trig_obj = \
trig_c4.lo \
trig_c8.lo
gfor_math_exp_obj = \
exp_c4.lo \
exp_c8.lo
gfor_math_hyp_obj = \
hyp_c4.lo \
hyp_c8.lo
# Machine generated specifics # Machine generated specifics
gfor_built_specific_src = \ gfor_built_specific_src = \
generated/_abs_c4.f90 \ generated/_abs_c4.f90 \
...@@ -690,30 +661,18 @@ generated/_mod_i8.f90 \ ...@@ -690,30 +661,18 @@ generated/_mod_i8.f90 \
generated/_mod_r4.f90 \ generated/_mod_r4.f90 \
generated/_mod_r8.f90 generated/_mod_r8.f90
#specific intrinsics requiring manal code
#gfor_specific_c= \
#intrinsics/_aimag.c \
#intrinsics/_cabs.c \
#foo
gfor_specific_src = \ gfor_specific_src = \
$(gfor_built_specific_src) \ $(gfor_built_specific_src) \
$(gfor_built_specific2_src) \ $(gfor_built_specific2_src) \
intrinsics/dprod_r8.f90 \ intrinsics/dprod_r8.f90 \
intrinsics/f2c_specifics.F90 intrinsics/f2c_specifics.F90
gfor_cmath_src = $(gfor_math_trig_c) $(gfor_math_exp_c) $(gfor_math_hyp_c) BUILT_SOURCES = $(gfor_built_src) $(gfor_built_specific_src) \
gfor_cmath_obj = $(gfor_math_trig_obj) $(gfor_math_exp_obj) \
$(gfor_math_hyp_obj)
BUILT_SOURCES = $(gfor_built_src) $(gfor_cmath_src) $(gfor_built_specific_src) \
$(gfor_built_specific2_src) $(gfor_built_specific2_src)
libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \ libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \
$(gfor_helper_src) $(gfor_io_headers) $(gfor_specific_src) $(gfor_helper_src) $(gfor_io_headers) $(gfor_specific_src)
EXTRA_libgfortran_la_SOURCES = $(gfor_cmath_src)
libgfortran_la_LIBADD = @MATH_OBJ@
libgfortran_la_DEPENDENCIES = @MATH_OBJ@
I_M4_DEPS = m4/iparm.m4 I_M4_DEPS = m4/iparm.m4
I_M4_DEPS0 = $(I_M4_DEPS) m4/iforeach.m4 I_M4_DEPS0 = $(I_M4_DEPS) m4/iforeach.m4
I_M4_DEPS1 = $(I_M4_DEPS) m4/ifunction.m4 I_M4_DEPS1 = $(I_M4_DEPS) m4/ifunction.m4
...@@ -1411,24 +1370,6 @@ in_unpack_generic.lo: runtime/in_unpack_generic.c ...@@ -1411,24 +1370,6 @@ in_unpack_generic.lo: runtime/in_unpack_generic.c
normalize.lo: runtime/normalize.c normalize.lo: runtime/normalize.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o normalize.lo `test -f 'runtime/normalize.c' || echo '$(srcdir)/'`runtime/normalize.c $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o normalize.lo `test -f 'runtime/normalize.c' || echo '$(srcdir)/'`runtime/normalize.c
trig_c4.lo: generated/trig_c4.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o trig_c4.lo `test -f 'generated/trig_c4.c' || echo '$(srcdir)/'`generated/trig_c4.c
trig_c8.lo: generated/trig_c8.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o trig_c8.lo `test -f 'generated/trig_c8.c' || echo '$(srcdir)/'`generated/trig_c8.c
exp_c4.lo: generated/exp_c4.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o exp_c4.lo `test -f 'generated/exp_c4.c' || echo '$(srcdir)/'`generated/exp_c4.c
exp_c8.lo: generated/exp_c8.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o exp_c8.lo `test -f 'generated/exp_c8.c' || echo '$(srcdir)/'`generated/exp_c8.c
hyp_c4.lo: generated/hyp_c4.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hyp_c4.lo `test -f 'generated/hyp_c4.c' || echo '$(srcdir)/'`generated/hyp_c4.c
hyp_c8.lo: generated/hyp_c8.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hyp_c8.lo `test -f 'generated/hyp_c8.c' || echo '$(srcdir)/'`generated/hyp_c8.c
.f90.o: .f90.o:
$(FCCOMPILE) -c -o $@ $< $(FCCOMPILE) -c -o $@ $<
...@@ -2035,15 +1976,6 @@ selected_real_kind.inc: $(srcdir)/mk-srk-inc.sh ...@@ -2035,15 +1976,6 @@ selected_real_kind.inc: $(srcdir)/mk-srk-inc.sh
@MAINTAINER_MODE_TRUE@$(i_pow_c): m4/pow.m4 $(I_M4_DEPS) @MAINTAINER_MODE_TRUE@$(i_pow_c): m4/pow.m4 $(I_M4_DEPS)
@MAINTAINER_MODE_TRUE@ m4 -Dfile=$@ -I$(srcdir)/m4 pow.m4 > $(srcdir)/$@ @MAINTAINER_MODE_TRUE@ m4 -Dfile=$@ -I$(srcdir)/m4 pow.m4 > $(srcdir)/$@
@MAINTAINER_MODE_TRUE@$(gfor_math_trig_c): m4/ctrig.m4 m4/mtype.m4
@MAINTAINER_MODE_TRUE@ m4 -Dfile=$@ -I$(srcdir)/m4 ctrig.m4 > $(srcdir)/$@
@MAINTAINER_MODE_TRUE@$(gfor_math_exp_c): m4/cexp.m4 m4/mtype.m4
@MAINTAINER_MODE_TRUE@ m4 -Dfile=$@ -I$(srcdir)/m4 cexp.m4 > $(srcdir)/$@
@MAINTAINER_MODE_TRUE@$(gfor_math_hyp_c): m4/chyp.m4 m4/mtype.m4
@MAINTAINER_MODE_TRUE@ m4 -Dfile=$@ -I$(srcdir)/m4 chyp.m4 > $(srcdir)/$@
@MAINTAINER_MODE_TRUE@$(gfor_built_specific_src): m4/specific.m4 m4/head.m4 @MAINTAINER_MODE_TRUE@$(gfor_built_specific_src): m4/specific.m4 m4/head.m4
@MAINTAINER_MODE_TRUE@ m4 -Dfile=$@ -I$(srcdir)/m4 specific.m4 > $(srcdir)/$@ @MAINTAINER_MODE_TRUE@ m4 -Dfile=$@ -I$(srcdir)/m4 specific.m4 > $(srcdir)/$@
......
...@@ -29,6 +29,7 @@ Boston, MA 02110-1301, USA. */ ...@@ -29,6 +29,7 @@ Boston, MA 02110-1301, USA. */
#ifndef C99_PROTOS_H #ifndef C99_PROTOS_H
#define C99_PROTOS_H #define C99_PROTOS_H
/* float variants of libm functions */
#ifndef HAVE_ACOSF #ifndef HAVE_ACOSF
extern float acosf(float); extern float acosf(float);
#endif #endif
...@@ -130,11 +131,11 @@ extern float tanhf(float); ...@@ -130,11 +131,11 @@ extern float tanhf(float);
#endif #endif
#ifndef HAVE_TRUNC #ifndef HAVE_TRUNC
extern double trunc(double x); extern double trunc(double);
#endif #endif
#ifndef HAVE_TRUNCF #ifndef HAVE_TRUNCF
extern float truncf(float x); extern float truncf(float);
#endif #endif
#ifndef HAVE_NEXTAFTERF #ifndef HAVE_NEXTAFTERF
...@@ -153,9 +154,223 @@ extern double round(double); ...@@ -153,9 +154,223 @@ extern double round(double);
extern float roundf(float); extern float roundf(float);
#endif #endif
/* log10l is needed on all platforms for decimal I/O */
#ifndef HAVE_LOG10L #ifndef HAVE_LOG10L
#define HAVE_LOG10L
extern long double log10l(long double); extern long double log10l(long double);
#endif #endif
/* complex math functions */
#if !defined(HAVE_CABSF)
#define HAVE_CABSF
extern float cabsf (float complex);
#endif
#if !defined(HAVE_CABS)
#define HAVE_CABS
extern double cabs (double complex);
#endif
#if !defined(HAVE_CABSL) && defined(HAVE_HYPOTL)
#define HAVE_CABSL
extern long double cabsl (long double complex);
#endif
#if !defined(HAVE_CARGF)
#define HAVE_CARGF
extern float cargf (float complex);
#endif
#if !defined(HAVE_CARG)
#define HAVE_CARG
extern double carg (double complex);
#endif
#if !defined(HAVE_CARGL) && defined(HAVE_ATAN2L)
#define HAVE_CARGL
extern long double cargl (long double complex);
#endif
#if !defined(HAVE_CEXPF)
#define HAVE_CEXPF
extern float complex cexpf (float complex);
#endif
#if !defined(HAVE_CEXP)
#define HAVE_CEXP
extern double complex cexp (double complex);
#endif
#if !defined(HAVE_CEXPL) && defined(HAVE_COSL) && defined(HAVE_SINL) && defined(EXPL)
#define HAVE_CEXPL
extern long double complex cexpl (long double complex);
#endif
#if !defined(HAVE_CLOGF)
#define HAVE_CLOGF
extern float complex clogf (float complex);
#endif
#if !defined(HAVE_CLOG)
#define HAVE_CLOG
extern double complex clog (double complex);
#endif
#if !defined(HAVE_CLOGL) && defined(HAVE_LOGL) && defined(HAVE_CABSL) && defined(HAVE_CARGL)
#define HAVE_CLOGL
extern long double complex clogl (long double complex);
#endif
#if !defined(HAVE_CLOG10F)
#define HAVE_CLOG10F
extern float complex clog10f (float complex);
#endif
#if !defined(HAVE_CLOG10)
#define HAVE_CLOG10
extern double complex clog10 (double complex);
#endif
#if !defined(HAVE_CLOG10L) && defined(HAVE_LOG10L) && defined(HAVE_CABSL) && defined(HAVE_CARGL)
#define HAVE_CLOG10L
extern long double complex clog10l (long double complex);
#endif
#if !defined(HAVE_CPOWF)
#define HAVE_CPOWF
extern float complex cpowf (float complex, float complex);
#endif
#if !defined(HAVE_CPOW)
#define HAVE_CPOW
extern double complex cpow (double complex, double complex);
#endif
#if !defined(HAVE_CPOWL) && defined(HAVE_CEXPL) && defined(HAVE_CLOGL)
#define HAVE_CPOWL
extern long double complex cpowl (long double complex, long double complex);
#endif
#if !defined(HAVE_CSQRTF)
#define HAVE_CSQRTF
extern float complex csqrtf (float complex);
#endif
#if !defined(HAVE_CSQRT)
#define HAVE_CSQRT
extern double complex csqrt (double complex);
#endif
#if !defined(HAVE_CSQRTL) && defined(HAVE_COPYSIGNL) && defined(HAVE_SQRTL) && defined(HAVE_FABSL) && defined(HAVE_HYPOTL)
#define HAVE_CSQRTL
extern long double complex csqrtl (long double complex);
#endif
#if !defined(HAVE_CSINHF)
#define HAVE_CSINHF
extern float complex csinhf (float complex);
#endif
#if !defined(HAVE_CSINH)
#define HAVE_CSINH
extern double complex csinh (double complex);
#endif
#if !defined(HAVE_CSINHL) && defined(HAVE_COSL) && defined(HAVE_COSHL) && defined(HAVE_SINL) && defined(HAVE_SINHL)
#define HAVE_CSINHL
extern long double complex csinhl (long double complex);
#endif
#if !defined(HAVE_CCOSHF)
#define HAVE_CCOSHF
extern float complex ccoshf (float complex);
#endif
#if !defined(HAVE_CCOSH)
#define HAVE_CCOSH
extern double complex ccosh (double complex);
#endif
#if !defined(HAVE_CCOSHL) && defined(HAVE_COSL) && defined(HAVE_COSHL) && defined(HAVE_SINL) && defined(HAVE_SINHL)
#define HAVE_CCOSHL
extern long double complex ccoshl (long double complex);
#endif
#if !defined(HAVE_CTANHF)
#define HAVE_CTANHF
extern float complex ctanhf (float complex);
#endif
#if !defined(HAVE_CTANH)
#define HAVE_CTANH
extern double complex ctanh (double complex);
#endif
#if !defined(HAVE_CTANHL) && defined(HAVE_TANL) && defined(HAVE_TANHL)
#define HAVE_CTANHL
extern long double complex ctanhl (long double complex);
#endif
#if !defined(HAVE_CSINF)
#define HAVE_CSINF
extern float complex csinf (float complex);
#endif
#if !defined(HAVE_CSIN)
#define HAVE_CSIN
extern double complex csin (double complex);
#endif
#if !defined(HAVE_CSINL) && defined(HAVE_COSL) && defined(HAVE_COSHL) && defined(HAVE_SINL) && defined(HAVE_SINHL)
#define HAVE_CSINL
extern long double complex csinl (long double complex);
#endif
#if !defined(HAVE_CCOSF)
#define HAVE_CCOSF
extern float complex ccosf (float complex);
#endif
#if !defined(HAVE_CCOS)
#define HAVE_CCOS
extern double complex ccos (double complex);
#endif
#if !defined(HAVE_CCOSL) && defined(HAVE_COSL) && defined(HAVE_COSHL) && defined(HAVE_SINL) && defined(HAVE_SINHL)
#define HAVE_CCOSL
extern long double complex ccosl (long double complex);
#endif
#if !defined(HAVE_CTANF)
#define HAVE_CTANF
extern float complex ctanf (float complex);
#endif
#if !defined(HAVE_CTAN)
#define HAVE_CTAN
extern double complex ctan (double complex);
#endif
#if !defined(HAVE_CTANL) && defined(HAVE_TANL) && defined(HAVE_TANHL)
#define HAVE_CTANL
extern long double complex ctanl (long double complex);
#endif
#endif /* C99_PROTOS_H */ #endif /* C99_PROTOS_H */
...@@ -3,27 +3,69 @@ ...@@ -3,27 +3,69 @@
/* Does gettimeofday take a single argument */ /* Does gettimeofday take a single argument */
#undef GETTIMEOFDAY_ONE_ARGUMENT #undef GETTIMEOFDAY_ONE_ARGUMENT
/* libm includes acos */
#undef HAVE_ACOS
/* libm includes acosf */ /* libm includes acosf */
#undef HAVE_ACOSF #undef HAVE_ACOSF
/* libm includes acosh */
#undef HAVE_ACOSH
/* libm includes acoshf */ /* libm includes acoshf */
#undef HAVE_ACOSHF #undef HAVE_ACOSHF
/* libm includes acoshl */
#undef HAVE_ACOSHL
/* libm includes acosl */
#undef HAVE_ACOSL
/* libm includes asin */
#undef HAVE_ASIN
/* libm includes asinf */ /* libm includes asinf */
#undef HAVE_ASINF #undef HAVE_ASINF
/* libm includes asinh */
#undef HAVE_ASINH
/* libm includes asinhf */ /* libm includes asinhf */
#undef HAVE_ASINHF #undef HAVE_ASINHF
/* libm includes asinhl */
#undef HAVE_ASINHL
/* libm includes asinl */
#undef HAVE_ASINL
/* libm includes atan */
#undef HAVE_ATAN
/* libm includes atan2 */
#undef HAVE_ATAN2
/* libm includes atan2f */ /* libm includes atan2f */
#undef HAVE_ATAN2F #undef HAVE_ATAN2F
/* libm includes atan2l */
#undef HAVE_ATAN2L
/* libm includes atanf */ /* libm includes atanf */
#undef HAVE_ATANF #undef HAVE_ATANF
/* libm includes atanh */
#undef HAVE_ATANH
/* libm includes atanhf */ /* libm includes atanhf */
#undef HAVE_ATANHF #undef HAVE_ATANHF
/* libm includes atanhl */
#undef HAVE_ATANHL
/* libm includes atanl */
#undef HAVE_ATANL
/* Define to 1 if the target supports __attribute__((alias(...))). */ /* Define to 1 if the target supports __attribute__((alias(...))). */
#undef HAVE_ATTRIBUTE_ALIAS #undef HAVE_ATTRIBUTE_ALIAS
...@@ -33,30 +75,171 @@ ...@@ -33,30 +75,171 @@
/* Define to 1 if the target supports __attribute__((visibility(...))). */ /* Define to 1 if the target supports __attribute__((visibility(...))). */
#undef HAVE_ATTRIBUTE_VISIBILITY #undef HAVE_ATTRIBUTE_VISIBILITY
/* libm includes cabs */
#undef HAVE_CABS
/* libm includes cabsf */
#undef HAVE_CABSF
/* libm includes cabsl */
#undef HAVE_CABSL
/* libm includes carg */
#undef HAVE_CARG
/* libm includes cargf */
#undef HAVE_CARGF
/* libm includes cargl */
#undef HAVE_CARGL
/* libm includes ccos */
#undef HAVE_CCOS
/* libm includes ccosf */
#undef HAVE_CCOSF
/* libm includes ccosh */
#undef HAVE_CCOSH
/* libm includes ccoshf */
#undef HAVE_CCOSHF
/* libm includes ccoshl */
#undef HAVE_CCOSHL
/* libm includes ccosl */
#undef HAVE_CCOSL
/* libm includes ceil */
#undef HAVE_CEIL
/* libm includes ceilf */ /* libm includes ceilf */
#undef HAVE_CEILF #undef HAVE_CEILF
/* libm includes ceill */
#undef HAVE_CEILL
/* libm includes cexp */
#undef HAVE_CEXP
/* libm includes cexpf */
#undef HAVE_CEXPF
/* libm includes cexpl */
#undef HAVE_CEXPL
/* Define to 1 if you have the `chdir' function. */ /* Define to 1 if you have the `chdir' function. */
#undef HAVE_CHDIR #undef HAVE_CHDIR
/* Define to 1 if you have the `chsize' function. */ /* Define to 1 if you have the `chsize' function. */
#undef HAVE_CHSIZE #undef HAVE_CHSIZE
/* libm includes clog */
#undef HAVE_CLOG
/* libm includes clog10 */
#undef HAVE_CLOG10
/* libm includes clog10f */
#undef HAVE_CLOG10F
/* libm includes clog10l */
#undef HAVE_CLOG10L
/* libm includes clogf */
#undef HAVE_CLOGF
/* libm includes clogl */
#undef HAVE_CLOGL
/* complex.h exists */ /* complex.h exists */
#undef HAVE_COMPLEX_H #undef HAVE_COMPLEX_H
/* libm includes copysign */
#undef HAVE_COPYSIGN
/* libm includes copysignf */ /* libm includes copysignf */
#undef HAVE_COPYSIGNF #undef HAVE_COPYSIGNF
/* libm includes copysignl */
#undef HAVE_COPYSIGNL
/* libm includes cos */
#undef HAVE_COS
/* libm includes cosf */ /* libm includes cosf */
#undef HAVE_COSF #undef HAVE_COSF
/* libm includes cosh */
#undef HAVE_COSH
/* libm includes coshf */ /* libm includes coshf */
#undef HAVE_COSHF #undef HAVE_COSHF
/* libm includes coshl */
#undef HAVE_COSHL
/* libm includes cosl */
#undef HAVE_COSL
/* libm includes cpow */
#undef HAVE_CPOW
/* libm includes cpowf */
#undef HAVE_CPOWF
/* libm includes cpowl */
#undef HAVE_CPOWL
/* Define if CRLF is line terminator. */ /* Define if CRLF is line terminator. */
#undef HAVE_CRLF #undef HAVE_CRLF
/* libm includes csin */
#undef HAVE_CSIN
/* libm includes csinf */
#undef HAVE_CSINF
/* libm includes csinh */
#undef HAVE_CSINH
/* libm includes csinhf */
#undef HAVE_CSINHF
/* libm includes csinhl */
#undef HAVE_CSINHL
/* libm includes csinl */
#undef HAVE_CSINL
/* libm includes csqrt */
#undef HAVE_CSQRT
/* libm includes csqrtf */
#undef HAVE_CSQRTF
/* libm includes csqrtl */
#undef HAVE_CSQRTL
/* libm includes ctan */
#undef HAVE_CTAN
/* libm includes ctanf */
#undef HAVE_CTANF
/* libm includes ctanh */
#undef HAVE_CTANH
/* libm includes ctanhf */
#undef HAVE_CTANHF
/* libm includes ctanhl */
#undef HAVE_CTANHL
/* libm includes ctanl */
#undef HAVE_CTANL
/* libm includes erf */ /* libm includes erf */
#undef HAVE_ERF #undef HAVE_ERF
...@@ -66,24 +249,54 @@ ...@@ -66,24 +249,54 @@
/* libm includes erfcf */ /* libm includes erfcf */
#undef HAVE_ERFCF #undef HAVE_ERFCF
/* libm includes erfcl */
#undef HAVE_ERFCL
/* libm includes erff */ /* libm includes erff */
#undef HAVE_ERFF #undef HAVE_ERFF
/* libm includes erfl */
#undef HAVE_ERFL
/* libm includes exp */
#undef HAVE_EXP
/* libm includes expf */ /* libm includes expf */
#undef HAVE_EXPF #undef HAVE_EXPF
/* libm includes expl */
#undef HAVE_EXPL
/* libm includes fabs */
#undef HAVE_FABS
/* libm includes fabsf */ /* libm includes fabsf */
#undef HAVE_FABSF #undef HAVE_FABSF
/* libm includes fabsl */
#undef HAVE_FABSL
/* libm includes finite */ /* libm includes finite */
#undef HAVE_FINITE #undef HAVE_FINITE
/* libm includes floor */
#undef HAVE_FLOOR
/* libm includes floorf */ /* libm includes floorf */
#undef HAVE_FLOORF #undef HAVE_FLOORF
/* libm includes floorl */
#undef HAVE_FLOORL
/* libm includes frexp */
#undef HAVE_FREXP
/* libm includes frexpf */ /* libm includes frexpf */
#undef HAVE_FREXPF #undef HAVE_FREXPF
/* libm includes frexpl */
#undef HAVE_FREXPL
/* Define to 1 if you have the `ftruncate' function. */ /* Define to 1 if you have the `ftruncate' function. */
#undef HAVE_FTRUNCATE #undef HAVE_FTRUNCATE
...@@ -111,9 +324,15 @@ ...@@ -111,9 +324,15 @@
/* libc includes getuid */ /* libc includes getuid */
#undef HAVE_GETUID #undef HAVE_GETUID
/* libm includes hypot */
#undef HAVE_HYPOT
/* libm includes hypotf */ /* libm includes hypotf */
#undef HAVE_HYPOTF #undef HAVE_HYPOTF
/* libm includes hypotl */
#undef HAVE_HYPOTL
/* Define to 1 if you have the <ieeefp.h> header file. */ /* Define to 1 if you have the <ieeefp.h> header file. */
#undef HAVE_IEEEFP_H #undef HAVE_IEEEFP_H
...@@ -126,24 +345,39 @@ ...@@ -126,24 +345,39 @@
/* libm includes j0f */ /* libm includes j0f */
#undef HAVE_J0F #undef HAVE_J0F
/* libm includes j0l */
#undef HAVE_J0L
/* libm includes j1 */ /* libm includes j1 */
#undef HAVE_J1 #undef HAVE_J1
/* libm includes j1f */ /* libm includes j1f */
#undef HAVE_J1F #undef HAVE_J1F
/* libm includes j1l */
#undef HAVE_J1L
/* libm includes jn */ /* libm includes jn */
#undef HAVE_JN #undef HAVE_JN
/* libm includes jnf */ /* libm includes jnf */
#undef HAVE_JNF #undef HAVE_JNF
/* libm includes jnl */
#undef HAVE_JNL
/* Define to 1 if you have the `kill' function. */ /* Define to 1 if you have the `kill' function. */
#undef HAVE_KILL #undef HAVE_KILL
/* Define to 1 if you have the `link' function. */ /* Define to 1 if you have the `link' function. */
#undef HAVE_LINK #undef HAVE_LINK
/* libm includes log */
#undef HAVE_LOG
/* libm includes log10 */
#undef HAVE_LOG10
/* libm includes log10f */ /* libm includes log10f */
#undef HAVE_LOG10F #undef HAVE_LOG10F
...@@ -153,6 +387,9 @@ ...@@ -153,6 +387,9 @@
/* libm includes logf */ /* libm includes logf */
#undef HAVE_LOGF #undef HAVE_LOGF
/* libm includes logl */
#undef HAVE_LOGL
/* Define to 1 if you have the <math.h> header file. */ /* Define to 1 if you have the <math.h> header file. */
#undef HAVE_MATH_H #undef HAVE_MATH_H
...@@ -171,42 +408,75 @@ ...@@ -171,42 +408,75 @@
/* libm includes nextafterf */ /* libm includes nextafterf */
#undef HAVE_NEXTAFTERF #undef HAVE_NEXTAFTERF
/* libm includes nextafterl */
#undef HAVE_NEXTAFTERL
/* Define to 1 if you have the `perror' function. */ /* Define to 1 if you have the `perror' function. */
#undef HAVE_PERROR #undef HAVE_PERROR
/* libm includes pow */
#undef HAVE_POW
/* libm includes powf */ /* libm includes powf */
#undef HAVE_POWF #undef HAVE_POWF
/* libm includes powl */
#undef HAVE_POWL
/* libm includes round */ /* libm includes round */
#undef HAVE_ROUND #undef HAVE_ROUND
/* libm includes roundf */ /* libm includes roundf */
#undef HAVE_ROUNDF #undef HAVE_ROUNDF
/* libm includes roundl */
#undef HAVE_ROUNDL
/* libm includes scalbn */ /* libm includes scalbn */
#undef HAVE_SCALBN #undef HAVE_SCALBN
/* libm includes scalbnf */ /* libm includes scalbnf */
#undef HAVE_SCALBNF #undef HAVE_SCALBNF
/* libm includes scalbnl */
#undef HAVE_SCALBNL
/* Define to 1 if you have the <signal.h> header file. */ /* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H #undef HAVE_SIGNAL_H
/* libm includes sin */
#undef HAVE_SIN
/* libm includes sinf */ /* libm includes sinf */
#undef HAVE_SINF #undef HAVE_SINF
/* libm includes sinh */
#undef HAVE_SINH
/* libm includes sinhf */ /* libm includes sinhf */
#undef HAVE_SINHF #undef HAVE_SINHF
/* libm includes sinhl */
#undef HAVE_SINHL
/* libm includes sinl */
#undef HAVE_SINL
/* Define to 1 if you have the `sleep' function. */ /* Define to 1 if you have the `sleep' function. */
#undef HAVE_SLEEP #undef HAVE_SLEEP
/* Define to 1 if you have the `snprintf' function. */ /* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF #undef HAVE_SNPRINTF
/* libm includes sqrt */
#undef HAVE_SQRT
/* libm includes sqrtf */ /* libm includes sqrtf */
#undef HAVE_SQRTF #undef HAVE_SQRTF
/* libm includes sqrtl */
#undef HAVE_SQRTL
/* Define to 1 if you have the <stddef.h> header file. */ /* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H #undef HAVE_STDDEF_H
...@@ -267,12 +537,24 @@ ...@@ -267,12 +537,24 @@
/* Define to 1 if you have the <sys/types.h> header file. */ /* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H #undef HAVE_SYS_TYPES_H
/* libm includes tan */
#undef HAVE_TAN
/* libm includes tanf */ /* libm includes tanf */
#undef HAVE_TANF #undef HAVE_TANF
/* libm includes tanh */
#undef HAVE_TANH
/* libm includes tanhf */ /* libm includes tanhf */
#undef HAVE_TANHF #undef HAVE_TANHF
/* libm includes tanhl */
#undef HAVE_TANHL
/* libm includes tanl */
#undef HAVE_TANL
/* Define to 1 if you have the `time' function. */ /* Define to 1 if you have the `time' function. */
#undef HAVE_TIME #undef HAVE_TIME
...@@ -291,6 +573,9 @@ ...@@ -291,6 +573,9 @@
/* libm includes truncf */ /* libm includes truncf */
#undef HAVE_TRUNCF #undef HAVE_TRUNCF
/* libm includes truncl */
#undef HAVE_TRUNCL
/* Define to 1 if you have the `ttyname' function. */ /* Define to 1 if you have the `ttyname' function. */
#undef HAVE_TTYNAME #undef HAVE_TTYNAME
...@@ -306,18 +591,27 @@ ...@@ -306,18 +591,27 @@
/* libm includes y0f */ /* libm includes y0f */
#undef HAVE_Y0F #undef HAVE_Y0F
/* libm includes y0l */
#undef HAVE_Y0L
/* libm includes y1 */ /* libm includes y1 */
#undef HAVE_Y1 #undef HAVE_Y1
/* libm includes y1f */ /* libm includes y1f */
#undef HAVE_Y1F #undef HAVE_Y1F
/* libm includes y1l */
#undef HAVE_Y1L
/* libm includes yn */ /* libm includes yn */
#undef HAVE_YN #undef HAVE_YN
/* libm includes ynf */ /* libm includes ynf */
#undef HAVE_YNF #undef HAVE_YNF
/* libm includes ynl */
#undef HAVE_YNL
/* Define to the address where bug reports for this package should be sent. */ /* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/* Complex exponential functions
Copyright 2002, 2004 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran 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 of the License, or (at your option) any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
Libgfortran is distributed in the hope that 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 libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <math.h>
#include "libgfortran.h"
/* z = a + ib */
/* Absolute value. */
GFC_REAL_4
cabsf (GFC_COMPLEX_4 z)
{
return hypotf (REALPART (z), IMAGPART (z));
}
/* Complex argument. The angle made with the +ve real axis.
Range -pi-pi. */
GFC_REAL_4
cargf (GFC_COMPLEX_4 z)
{
GFC_REAL_4 arg;
return atan2f (IMAGPART (z), REALPART (z));
}
/* exp(z) = exp(a)*(cos(b) + isin(b)) */
GFC_COMPLEX_4
cexpf (GFC_COMPLEX_4 z)
{
GFC_REAL_4 a;
GFC_REAL_4 b;
GFC_COMPLEX_4 v;
a = REALPART (z);
b = IMAGPART (z);
COMPLEX_ASSIGN (v, cosf (b), sinf (b));
return expf (a) * v;
}
/* log(z) = log (cabs(z)) + i*carg(z) */
GFC_COMPLEX_4
clogf (GFC_COMPLEX_4 z)
{
GFC_COMPLEX_4 v;
COMPLEX_ASSIGN (v, logf (cabsf (z)), cargf (z));
return v;
}
/* log10(z) = log10 (cabs(z)) + i*carg(z) */
GFC_COMPLEX_4
clog10f (GFC_COMPLEX_4 z)
{
GFC_COMPLEX_4 v;
COMPLEX_ASSIGN (v, log10f (cabsf (z)), cargf (z));
return v;
}
/* pow(base, power) = cexp (power * clog (base)) */
GFC_COMPLEX_4
cpowf (GFC_COMPLEX_4 base, GFC_COMPLEX_4 power)
{
return cexpf (power * clogf (base));
}
/* sqrt(z). Algorithm pulled from glibc. */
GFC_COMPLEX_4
csqrtf (GFC_COMPLEX_4 z)
{
GFC_REAL_4 re;
GFC_REAL_4 im;
GFC_COMPLEX_4 v;
re = REALPART (z);
im = IMAGPART (z);
if (im == 0.0)
{
if (re < 0.0)
{
COMPLEX_ASSIGN (v, 0.0, copysignf (sqrtf (-re), im));
}
else
{
COMPLEX_ASSIGN (v, fabsf (sqrtf (re)),
copysignf (0.0, im));
}
}
else if (re == 0.0)
{
GFC_REAL_4 r;
r = sqrtf (0.5 * fabsf (im));
COMPLEX_ASSIGN (v, copysignf (r, im), r);
}
else
{
GFC_REAL_4 d, r, s;
d = hypotf (re, im);
/* Use the identity 2 Re res Im res = Im x
to avoid cancellation error in d +/- Re x. */
if (re > 0)
{
r = sqrtf (0.5 * d + 0.5 * re);
s = (0.5 * im) / r;
}
else
{
s = sqrtf (0.5 * d - 0.5 * re);
r = fabsf ((0.5 * im) / s);
}
COMPLEX_ASSIGN (v, r, copysignf (s, im));
}
return v;
}
/* Complex exponential functions
Copyright 2002, 2004 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran 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 of the License, or (at your option) any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
Libgfortran is distributed in the hope that 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 libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <math.h>
#include "libgfortran.h"
/* z = a + ib */
/* Absolute value. */
GFC_REAL_8
cabs (GFC_COMPLEX_8 z)
{
return hypot (REALPART (z), IMAGPART (z));
}
/* Complex argument. The angle made with the +ve real axis.
Range -pi-pi. */
GFC_REAL_8
carg (GFC_COMPLEX_8 z)
{
GFC_REAL_8 arg;
return atan2 (IMAGPART (z), REALPART (z));
}
/* exp(z) = exp(a)*(cos(b) + isin(b)) */
GFC_COMPLEX_8
cexp (GFC_COMPLEX_8 z)
{
GFC_REAL_8 a;
GFC_REAL_8 b;
GFC_COMPLEX_8 v;
a = REALPART (z);
b = IMAGPART (z);
COMPLEX_ASSIGN (v, cos (b), sin (b));
return exp (a) * v;
}
/* log(z) = log (cabs(z)) + i*carg(z) */
GFC_COMPLEX_8
clog (GFC_COMPLEX_8 z)
{
GFC_COMPLEX_8 v;
COMPLEX_ASSIGN (v, log (cabs (z)), carg (z));
return v;
}
/* log10(z) = log10 (cabs(z)) + i*carg(z) */
GFC_COMPLEX_8
clog10 (GFC_COMPLEX_8 z)
{
GFC_COMPLEX_8 v;
COMPLEX_ASSIGN (v, log10 (cabs (z)), carg (z));
return v;
}
/* pow(base, power) = cexp (power * clog (base)) */
GFC_COMPLEX_8
cpow (GFC_COMPLEX_8 base, GFC_COMPLEX_8 power)
{
return cexp (power * clog (base));
}
/* sqrt(z). Algorithm pulled from glibc. */
GFC_COMPLEX_8
csqrt (GFC_COMPLEX_8 z)
{
GFC_REAL_8 re;
GFC_REAL_8 im;
GFC_COMPLEX_8 v;
re = REALPART (z);
im = IMAGPART (z);
if (im == 0.0)
{
if (re < 0.0)
{
COMPLEX_ASSIGN (v, 0.0, copysign (sqrt (-re), im));
}
else
{
COMPLEX_ASSIGN (v, fabs (sqrt (re)),
copysign (0.0, im));
}
}
else if (re == 0.0)
{
GFC_REAL_8 r;
r = sqrt (0.5 * fabs (im));
COMPLEX_ASSIGN (v, copysign (r, im), r);
}
else
{
GFC_REAL_8 d, r, s;
d = hypot (re, im);
/* Use the identity 2 Re res Im res = Im x
to avoid cancellation error in d +/- Re x. */
if (re > 0)
{
r = sqrt (0.5 * d + 0.5 * re);
s = (0.5 * im) / r;
}
else
{
s = sqrt (0.5 * d - 0.5 * re);
r = fabs ((0.5 * im) / s);
}
COMPLEX_ASSIGN (v, r, copysign (s, im));
}
return v;
}
/* Complex hyperbolic functions
Copyright 2002 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran 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 of the License, or (at your option) any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
Libgfortran is distributed in the hope that 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 libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <math.h>
#include "libgfortran.h"
/* Complex number z = a + ib. */
/* sinh(z) = sinh(a)cos(b) + icosh(a)sin(b) */
GFC_COMPLEX_4
csinhf (GFC_COMPLEX_4 a)
{
GFC_REAL_4 r;
GFC_REAL_4 i;
GFC_COMPLEX_4 v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, sinhf (r) * cosf (i), coshf (r) * sinf (i));
return v;
}
/* cosh(z) = cosh(a)cos(b) - isinh(a)sin(b) */
GFC_COMPLEX_4
ccoshf (GFC_COMPLEX_4 a)
{
GFC_REAL_4 r;
GFC_REAL_4 i;
GFC_COMPLEX_4 v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, coshf (r) * cosf (i), - (sinhf (r) * sinf (i)));
return v;
}
/* tanh(z) = (tanh(a) + itan(b)) / (1 - itanh(a)tan(b)) */
GFC_COMPLEX_4
ctanhf (GFC_COMPLEX_4 a)
{
GFC_REAL_4 rt;
GFC_REAL_4 it;
GFC_COMPLEX_4 n;
GFC_COMPLEX_4 d;
rt = tanhf (REALPART (a));
it = tanf (IMAGPART (a));
COMPLEX_ASSIGN (n, rt, it);
COMPLEX_ASSIGN (d, 1, - (rt * it));
return n / d;
}
/* Complex hyperbolic functions
Copyright 2002 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran 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 of the License, or (at your option) any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
Libgfortran is distributed in the hope that 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 libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <math.h>
#include "libgfortran.h"
/* Complex number z = a + ib. */
/* sinh(z) = sinh(a)cos(b) + icosh(a)sin(b) */
GFC_COMPLEX_8
csinh (GFC_COMPLEX_8 a)
{
GFC_REAL_8 r;
GFC_REAL_8 i;
GFC_COMPLEX_8 v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, sinh (r) * cos (i), cosh (r) * sin (i));
return v;
}
/* cosh(z) = cosh(a)cos(b) - isinh(a)sin(b) */
GFC_COMPLEX_8
ccosh (GFC_COMPLEX_8 a)
{
GFC_REAL_8 r;
GFC_REAL_8 i;
GFC_COMPLEX_8 v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, cosh (r) * cos (i), - (sinh (r) * sin (i)));
return v;
}
/* tanh(z) = (tanh(a) + itan(b)) / (1 - itanh(a)tan(b)) */
GFC_COMPLEX_8
ctanh (GFC_COMPLEX_8 a)
{
GFC_REAL_8 rt;
GFC_REAL_8 it;
GFC_COMPLEX_8 n;
GFC_COMPLEX_8 d;
rt = tanh (REALPART (a));
it = tan (IMAGPART (a));
COMPLEX_ASSIGN (n, rt, it);
COMPLEX_ASSIGN (d, 1, - (rt * it));
return n / d;
}
/* Complex trig functions
Copyright 2002 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran 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 of the License, or (at your option) any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
Libgfortran is distributed in the hope that 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 libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <math.h>
#include "libgfortran.h"
/* Complex number z = a + ib. */
/* sin(z) = sin(a)cosh(b) + icos(a)sinh(b) */
GFC_COMPLEX_4
csinf (GFC_COMPLEX_4 a)
{
GFC_REAL_4 r;
GFC_REAL_4 i;
GFC_COMPLEX_4 v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, sinf (r) * coshf (i), cosf (r) * sinhf (i));
return v;
}
/* cos(z) = cos(a)cosh(b) - isin(a)sinh(b) */
GFC_COMPLEX_4
ccosf (GFC_COMPLEX_4 a)
{
GFC_REAL_4 r;
GFC_REAL_4 i;
GFC_COMPLEX_4 v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, cosf (r) * coshf (i), - (sinf (r) * sinhf (i)));
return v;
}
/* tan(z) = (tan(a) + itanh(b)) / (1 - itan(a)tanh(b)) */
GFC_COMPLEX_4
ctanf (GFC_COMPLEX_4 a)
{
GFC_REAL_4 rt;
GFC_REAL_4 it;
GFC_COMPLEX_4 n;
GFC_COMPLEX_4 d;
rt = tanf (REALPART (a));
it = tanhf (IMAGPART (a));
COMPLEX_ASSIGN (n, rt, it);
COMPLEX_ASSIGN (d , 1, - (rt * it));
return n / d;
}
/* Complex trig functions
Copyright 2002 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran 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 of the License, or (at your option) any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
Libgfortran is distributed in the hope that 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 libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <math.h>
#include "libgfortran.h"
/* Complex number z = a + ib. */
/* sin(z) = sin(a)cosh(b) + icos(a)sinh(b) */
GFC_COMPLEX_8
csin (GFC_COMPLEX_8 a)
{
GFC_REAL_8 r;
GFC_REAL_8 i;
GFC_COMPLEX_8 v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, sin (r) * cosh (i), cos (r) * sinh (i));
return v;
}
/* cos(z) = cos(a)cosh(b) - isin(a)sinh(b) */
GFC_COMPLEX_8
ccos (GFC_COMPLEX_8 a)
{
GFC_REAL_8 r;
GFC_REAL_8 i;
GFC_COMPLEX_8 v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, cos (r) * cosh (i), - (sin (r) * sinh (i)));
return v;
}
/* tan(z) = (tan(a) + itanh(b)) / (1 - itan(a)tanh(b)) */
GFC_COMPLEX_8
ctan (GFC_COMPLEX_8 a)
{
GFC_REAL_8 rt;
GFC_REAL_8 it;
GFC_COMPLEX_8 n;
GFC_COMPLEX_8 d;
rt = tan (REALPART (a));
it = tanh (IMAGPART (a));
COMPLEX_ASSIGN (n, rt, it);
COMPLEX_ASSIGN (d , 1, - (rt * it));
return n / d;
}
...@@ -38,15 +38,15 @@ Boston, MA 02110-1301, USA. */ ...@@ -38,15 +38,15 @@ Boston, MA 02110-1301, USA. */
#define M_PI 3.14159265358979323846264338327 #define M_PI 3.14159265358979323846264338327
#endif #endif
#include "config.h"
#include "c99_protos.h"
#if HAVE_COMPLEX_H #if HAVE_COMPLEX_H
# include <complex.h> # include <complex.h>
#else #else
#define complex __complex__ #define complex __complex__
#endif #endif
#include "config.h"
#include "c99_protos.h"
#if HAVE_IEEEFP_H #if HAVE_IEEEFP_H
#include <ieeefp.h> #include <ieeefp.h>
#endif #endif
......
`/* Complex exponential functions
Copyright 2002, 2004 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran 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 of the License, or (at your option) any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
Libgfortran is distributed in the hope that 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 libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <math.h>
#include "libgfortran.h"'
include(`mtype.m4')dnl
/* z = a + ib */
/* Absolute value. */
real_type
cabs`'q (complex_type z)
{
return hypot`'q (REALPART (z), IMAGPART (z));
}
/* Complex argument. The angle made with the +ve real axis.
Range -pi-pi. */
real_type
carg`'q (complex_type z)
{
real_type arg;
return atan2`'q (IMAGPART (z), REALPART (z));
}
/* exp(z) = exp(a)*(cos(b) + isin(b)) */
complex_type
cexp`'q (complex_type z)
{
real_type a;
real_type b;
complex_type v;
a = REALPART (z);
b = IMAGPART (z);
COMPLEX_ASSIGN (v, cos`'q (b), sin`'q (b));
return exp`'q (a) * v;
}
/* log(z) = log (cabs(z)) + i*carg(z) */
complex_type
clog`'q (complex_type z)
{
complex_type v;
COMPLEX_ASSIGN (v, log`'q (cabs`'q (z)), carg`'q (z));
return v;
}
/* log10(z) = log10 (cabs(z)) + i*carg(z) */
complex_type
clog10`'q (complex_type z)
{
complex_type v;
COMPLEX_ASSIGN (v, log10`'q (cabs`'q (z)), carg`'q (z));
return v;
}
/* pow(base, power) = cexp (power * clog (base)) */
complex_type
cpow`'q (complex_type base, complex_type power)
{
return cexp`'q (power * clog`'q (base));
}
/* sqrt(z). Algorithm pulled from glibc. */
complex_type
csqrt`'q (complex_type z)
{
real_type re;
real_type im;
complex_type v;
re = REALPART (z);
im = IMAGPART (z);
if (im == 0.0)
{
if (re < 0.0)
{
COMPLEX_ASSIGN (v, 0.0, copysign`'q (sqrt`'q (-re), im));
}
else
{
COMPLEX_ASSIGN (v, fabs`'q (sqrt`'q (re)),
copysign`'q (0.0, im));
}
}
else if (re == 0.0)
{
real_type r;
r = sqrt`'q (0.5 * fabs`'q (im));
COMPLEX_ASSIGN (v, copysign`'q (r, im), r);
}
else
{
real_type d, r, s;
d = hypot`'q (re, im);
/* Use the identity 2 Re res Im res = Im x
to avoid cancellation error in d +/- Re x. */
if (re > 0)
{
r = sqrt`'q (0.5 * d + 0.5 * re);
s = (0.5 * im) / r;
}
else
{
s = sqrt`'q (0.5 * d - 0.5 * re);
r = fabs`'q ((0.5 * im) / s);
}
COMPLEX_ASSIGN (v, r, copysign`'q (s, im));
}
return v;
}
`/* Complex hyperbolic functions
Copyright 2002 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran 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 of the License, or (at your option) any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
Libgfortran is distributed in the hope that 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 libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <math.h>
#include "libgfortran.h"'
include(`mtype.m4')dnl
/* Complex number z = a + ib. */
/* sinh(z) = sinh(a)cos(b) + icosh(a)sin(b) */
complex_type
csinh`'q (complex_type a)
{
real_type r;
real_type i;
complex_type v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, sinh`'q (r) * cos`'q (i), cosh`'q (r) * sin`'q (i));
return v;
}
/* cosh(z) = cosh(a)cos(b) - isinh(a)sin(b) */
complex_type
ccosh`'q (complex_type a)
{
real_type r;
real_type i;
complex_type v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, cosh`'q (r) * cos`'q (i), - (sinh`'q (r) * sin`'q (i)));
return v;
}
/* tanh(z) = (tanh(a) + itan(b)) / (1 - itanh(a)tan(b)) */
complex_type
ctanh`'q (complex_type a)
{
real_type rt;
real_type it;
complex_type n;
complex_type d;
rt = tanh`'q (REALPART (a));
it = tan`'q (IMAGPART (a));
COMPLEX_ASSIGN (n, rt, it);
COMPLEX_ASSIGN (d, 1, - (rt * it));
return n / d;
}
`/* Complex trig functions
Copyright 2002 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran 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 of the License, or (at your option) any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
Libgfortran is distributed in the hope that 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 libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <math.h>
#include "libgfortran.h"'
include(`mtype.m4')dnl
/* Complex number z = a + ib. */
/* sin(z) = sin(a)cosh(b) + icos(a)sinh(b) */
complex_type
csin`'q (complex_type a)
{
real_type r;
real_type i;
complex_type v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, sin`'q (r) * cosh`'q (i), cos`'q (r) * sinh`'q (i));
return v;
}
/* cos(z) = cos(a)cosh(b) - isin(a)sinh(b) */
complex_type
ccos`'q (complex_type a)
{
real_type r;
real_type i;
complex_type v;
r = REALPART (a);
i = IMAGPART (a);
COMPLEX_ASSIGN (v, cos`'q (r) * cosh`'q (i), - (sin`'q (r) * sinh`'q (i)));
return v;
}
/* tan(z) = (tan(a) + itanh(b)) / (1 - itan(a)tanh(b)) */
complex_type
ctan`'q (complex_type a)
{
real_type rt;
real_type it;
complex_type n;
complex_type d;
rt = tan`'q (REALPART (a));
it = tanh`'q (IMAGPART (a));
COMPLEX_ASSIGN (n, rt, it);
COMPLEX_ASSIGN (d , 1, - (rt * it));
return n / d;
}
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