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

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAditya Upadhyay <aadit0402@gmail.com>2017-07-28 20:29:40 +0300
committerCorinna Vinschen <corinna@vinschen.de>2017-07-28 21:36:09 +0300
commit0e0900cb4033d82f8a34a05283724b3233306d80 (patch)
tree3225c3d07469a739d8be47e50f9ac94398144d71 /newlib/libm/complex
parent124ccc500e22e5d118fcb98a190cdeb699331de2 (diff)
Importing catanl long double complex method from NetBSD.
Diffstat (limited to 'newlib/libm/complex')
-rw-r--r--newlib/libm/complex/Makefile.am2
-rw-r--r--newlib/libm/complex/Makefile.in13
-rw-r--r--newlib/libm/complex/catanl.c77
3 files changed, 88 insertions, 4 deletions
diff --git a/newlib/libm/complex/Makefile.am b/newlib/libm/complex/Makefile.am
index 47b966216..897774197 100644
--- a/newlib/libm/complex/Makefile.am
+++ b/newlib/libm/complex/Makefile.am
@@ -14,7 +14,7 @@ lsrc = cabsl.c creall.c cimagl.c ccoshl.c cacoshl.c \
clogl.c csqrtl.c cargl.c cprojl.c cexpl.c \
cephes_subrl.c cacosl.c ccosl.c casinl.c \
catanhl.c conjl.c cpowl.c ctanhl.c ctanl.c \
- casinhl.c csinhl.c csinl.c
+ casinhl.c csinhl.c csinl.c catanl.c
fsrc = cabsf.c casinf.c ccosf.c cimagf.c cprojf.c \
csqrtf.c cacosf.c casinhf.c ccoshf.c clogf.c clog10f.c \
diff --git a/newlib/libm/complex/Makefile.in b/newlib/libm/complex/Makefile.in
index d52bc517c..ba30971be 100644
--- a/newlib/libm/complex/Makefile.in
+++ b/newlib/libm/complex/Makefile.in
@@ -101,7 +101,8 @@ am__objects_3 = lib_a-cabsl.$(OBJEXT) lib_a-creall.$(OBJEXT) \
lib_a-catanhl.$(OBJEXT) lib_a-conjl.$(OBJEXT) \
lib_a-cpowl.$(OBJEXT) lib_a-ctanhl.$(OBJEXT) \
lib_a-ctanl.$(OBJEXT) lib_a-casinhl.$(OBJEXT) \
- lib_a-csinhl.$(OBJEXT) lib_a-csinl.$(OBJEXT)
+ lib_a-csinhl.$(OBJEXT) lib_a-csinl.$(OBJEXT) \
+ lib_a-catanl.$(OBJEXT)
@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \
@USE_LIBTOOL_FALSE@ $(am__objects_2) $(am__objects_3)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
@@ -119,7 +120,7 @@ am__objects_5 = cabsf.lo casinf.lo ccosf.lo cimagf.lo cprojf.lo \
am__objects_6 = cabsl.lo creall.lo cimagl.lo ccoshl.lo cacoshl.lo \
clogl.lo csqrtl.lo cargl.lo cprojl.lo cexpl.lo cephes_subrl.lo \
cacosl.lo ccosl.lo casinl.lo catanhl.lo conjl.lo cpowl.lo \
- ctanhl.lo ctanl.lo casinhl.lo csinhl.lo csinl.lo
+ ctanhl.lo ctanl.lo casinhl.lo csinhl.lo csinl.lo catanl.lo
@USE_LIBTOOL_TRUE@am_libcomplex_la_OBJECTS = $(am__objects_4) \
@USE_LIBTOOL_TRUE@ $(am__objects_5) $(am__objects_6)
libcomplex_la_OBJECTS = $(am_libcomplex_la_OBJECTS)
@@ -290,7 +291,7 @@ lsrc = cabsl.c creall.c cimagl.c ccoshl.c cacoshl.c \
clogl.c csqrtl.c cargl.c cprojl.c cexpl.c \
cephes_subrl.c cacosl.c ccosl.c casinl.c \
catanhl.c conjl.c cpowl.c ctanhl.c ctanl.c \
- casinhl.c csinhl.c csinl.c
+ casinhl.c csinhl.c csinl.c catanl.c
fsrc = cabsf.c casinf.c ccosf.c cimagf.c cprojf.c \
csqrtf.c cacosf.c casinhf.c ccoshf.c clogf.c clog10f.c \
@@ -814,6 +815,12 @@ lib_a-csinl.o: csinl.c
lib_a-csinl.obj: csinl.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-csinl.obj `if test -f 'csinl.c'; then $(CYGPATH_W) 'csinl.c'; else $(CYGPATH_W) '$(srcdir)/csinl.c'; fi`
+lib_a-catanl.o: catanl.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catanl.o `test -f 'catanl.c' || echo '$(srcdir)/'`catanl.c
+
+lib_a-catanl.obj: catanl.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catanl.obj `if test -f 'catanl.c'; then $(CYGPATH_W) 'catanl.c'; else $(CYGPATH_W) '$(srcdir)/catanl.c'; fi`
+
mostlyclean-libtool:
-rm -f *.lo
diff --git a/newlib/libm/complex/catanl.c b/newlib/libm/complex/catanl.c
new file mode 100644
index 000000000..ee2a25930
--- /dev/null
+++ b/newlib/libm/complex/catanl.c
@@ -0,0 +1,77 @@
+/* $NetBSD: catanl.c,v 1.1 2014/10/10 00:48:18 christos Exp $ */
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software written by Stephen L. Moshier.
+ * It is redistributed by the NetBSD Foundation by permission of the author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subrl.h"
+
+#ifdef __weak_alias
+__weak_alias(catanl, _catanl)
+#endif
+
+long double complex
+catanl(long double complex z)
+{
+ long double complex w;
+ long double a, t, x, x2, y;
+
+ x = creall(z);
+ y = cimagl(z);
+
+ if ((x == 0.0L) && (y > 1.0L))
+ goto ovrf;
+
+ x2 = x * x;
+ a = 1.0L - x2 - (y * y);
+ if (a == 0.0)
+ goto ovrf;
+
+ t = 0.5L * atan2l(2.0L * x, a);
+ w = _redupil(t);
+
+ t = y - 1.0L;
+ a = x2 + (t * t);
+ if (a == 0.0L)
+ goto ovrf;
+
+ t = y + 1.0L;
+ a = (x2 + (t * t))/a;
+ w = w + (0.25L * logl(a)) * I;
+ return w;
+
+ovrf:
+#if 0
+ mtherr ("catanl", OVERFLOW);
+#endif
+ w = HUGE_VALL + HUGE_VALL * I;
+ return w;
+}
+