public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Adding cexpl.c to newlib
@ 2017-06-24 19:57 Aditya Upadhyay
  0 siblings, 0 replies; only message in thread
From: Aditya Upadhyay @ 2017-06-24 19:57 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 171 bytes --]

Hello Developers,

This is the patch for cexpl method from long double complex method.
Please review the same and suggest me any changes needed.

Thanks & Regards,
Aditya

[-- Attachment #2: 0001-Adding-cexpl.c-to-newlib.patch --]
[-- Type: text/x-patch, Size: 6016 bytes --]

From 299d624f84d134a109554da78a1177438cddab71 Mon Sep 17 00:00:00 2001
From: Aditya Upadhyay <aadit0402@gmail.com>
Date: Sun, 25 Jun 2017 01:26:03 +0530
Subject: [PATCH] Adding cexpl.c to newlib.

---
 newlib/libm/complex/Makefile.am |  2 +-
 newlib/libm/complex/Makefile.in | 12 ++++++++---
 newlib/libm/complex/cexpl.c     | 46 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 4 deletions(-)
 create mode 100644 newlib/libm/complex/cexpl.c

diff --git a/newlib/libm/complex/Makefile.am b/newlib/libm/complex/Makefile.am
index f42f35e..9940f62 100644
--- a/newlib/libm/complex/Makefile.am
+++ b/newlib/libm/complex/Makefile.am
@@ -10,7 +10,7 @@ src = cabs.c cacos.c cacosh.c carg.c casin.c casinh.c \
       cpow.c cproj.c  creal.c  \
       csin.c csinh.c csqrt.c ctan.c ctanh.c
 
-lsrc = cabsl.c creall.c cimagl.c ccoshl.c cacoshl.c csqrtl.c clogl.c cephes_subrl.c cargl.c cprojl.c
+lsrc = cabsl.c creall.c cimagl.c ccoshl.c cacoshl.c csqrtl.c clogl.c cephes_subrl.c cargl.c cprojl.c cexpl.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 ceadf0f..d5d6c3d 100644
--- a/newlib/libm/complex/Makefile.in
+++ b/newlib/libm/complex/Makefile.in
@@ -99,7 +99,7 @@ am__objects_2 = lib_a-cabsf.$(OBJEXT) lib_a-casinf.$(OBJEXT) \
 am__objects_3 = lib_a-cabsl.$(OBJEXT) lib_a-creall.$(OBJEXT) \
 	lib_a-cimagl.$(OBJEXT) lib_a-ccoshl.$(OBJEXT) lib_a-cacoshl.$(OBJEXT) \
         lib_a-clogl.$(OBJEXT) lib_a-csqrtl.$(OBJEXT) lib_a-cephes_subrl.$(OBJEXT) \
-        lib_a-cargl.$(OBJEXT) lib_a-cprojl.$(OBJEXT)
+        lib_a-cargl.$(OBJEXT) lib_a-cprojl.$(OBJEXT) lib_a-cexpl.$(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)
@@ -115,7 +115,7 @@ am__objects_5 = cabsf.lo casinf.lo ccosf.lo cimagf.lo cprojf.lo \
 	conjf.lo csinf.lo ctanhf.lo cargf.lo catanhf.lo cexpf.lo \
 	cpowf.lo csinhf.lo
 am__objects_6 = cabsl.lo creall.lo cimagl.lo ccoshl.lo cacoshl.lo \
-        clogl.lo csqrtl.lo cephes_subrl.lo cargl.lo cprojl.lo
+        clogl.lo csqrtl.lo cephes_subrl.lo cargl.lo cprojl.lo cexpl.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)
@@ -279,7 +279,7 @@ src = cabs.c cacos.c cacosh.c carg.c casin.c casinh.c \
       cpow.c cproj.c  creal.c  \
       csin.c csinh.c csqrt.c ctan.c ctanh.c
 
-lsrc = cabsl.c creall.c cimagl.c ccoshl.c cacoshl.c clogl.c csqrtl.c cephes_subrl.c cargl.c cprojl.c
+lsrc = cabsl.c creall.c cimagl.c ccoshl.c cacoshl.c clogl.c csqrtl.c cephes_subrl.c cargl.c cprojl.c cexpl.c
 fsrc = cabsf.c casinf.c ccosf.c cimagf.c cprojf.c  \
         csqrtf.c cacosf.c casinhf.c ccoshf.c clogf.c clog10f.c \
         crealf.c ctanf.c cacoshf.c catanf.c   \
@@ -656,6 +656,12 @@ lib_a-cprojl.o: cprojl.c
 lib_a-cprojl.obj: cprojl.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cprojl.obj `if test -f 'cprojl.c'; then $(CYGPATH_W) 'cprojl.c'; else $(CYGPATH_W) '$(srcdir)/cprojl.c'; fi`
 
+lib_a-cexpl.o: cexpl.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cexpl.o `test -f 'cexpl.c' || echo '$(srcdir)/'`cexpl.c
+
+lib_a-cexpl.obj: cexpl.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cexpl.obj `if test -f 'cexpl.c'; then $(CYGPATH_W) 'cexpl.c'; else $(CYGPATH_W) '$(srcdir)/cexpl.c'; fi`
+
 lib_a-catanhf.o: catanhf.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-catanhf.o `test -f 'catanhf.c' || echo '$(srcdir)/'`catanhf.c
 
diff --git a/newlib/libm/complex/cexpl.c b/newlib/libm/complex/cexpl.c
new file mode 100644
index 0000000..8b56634
--- /dev/null
+++ b/newlib/libm/complex/cexpl.c
@@ -0,0 +1,46 @@
+/* $NetBSD: cexpl.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>
+
+long double complex
+cexpl(long double complex z)
+{
+	long double complex w;
+	long double r, x, y;
+
+	x = creall(z);
+	y = cimagl(z);
+	r = expl(x);
+	w = r * cosl(y) + r * sinl(y) * I;
+	return w;
+}
-- 
2.7.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-24 19:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-24 19:57 Adding cexpl.c to newlib Aditya Upadhyay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).