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

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

Hello Developers,

This is the patch for cacosl.c imported from NetBSD. Please review the
same and suggest me any needed modification.

Thanks & Regards,
Aditya Upadhyay

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

From 096f9b16b85d009aa58223d14570bf0d83f861a5 Mon Sep 17 00:00:00 2001
From: Aditya Upadhyay <aadit0402@gmail.com>
Date: Sun, 25 Jun 2017 01:55:47 +0530
Subject: [PATCH] Adding cacosl.c to newlib.

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

diff --git a/newlib/libm/complex/Makefile.am b/newlib/libm/complex/Makefile.am
index 9940f62..fb57c39 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 cexpl.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 cacosl.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 d5d6c3d..0139415 100644
--- a/newlib/libm/complex/Makefile.in
+++ b/newlib/libm/complex/Makefile.in
@@ -99,7 +99,8 @@ 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-cexpl.$(OBJEXT)
+        lib_a-cargl.$(OBJEXT) lib_a-cprojl.$(OBJEXT) lib_a-cexpl.$(OBJEXT) \
+        lib_a-cacosl.$(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 +116,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 cexpl.lo
+        clogl.lo csqrtl.lo cephes_subrl.lo cargl.lo cprojl.lo cexpl.lo cacosl.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 +280,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 cexpl.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 cacosl.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   \
@@ -662,6 +663,12 @@ lib_a-cexpl.o: 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-cacosl.o: cacosl.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cacosl.o `test -f 'cacosl.c' || echo '$(srcdir)/'`cacosl.c
+
+lib_a-cacosl.obj: cacosl.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cacosl.obj `if test -f 'cacosl.c'; then $(CYGPATH_W) 'cacosl.c'; else $(CYGPATH_W) '$(srcdir)/cacosl.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/cacosl.c b/newlib/libm/complex/cacosl.c
new file mode 100644
index 0000000..6a05c8c
--- /dev/null
+++ b/newlib/libm/complex/cacosl.c
@@ -0,0 +1,45 @@
+/* $NetBSD: cacosl.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"
+
+long double complex
+cacosl(long double complex z)
+{
+	long double complex w;
+
+	w = casinl(z);
+	w = (M_PI_2L - creall(w)) - cimagl(w) * I;
+	return w;
+}
+
-- 
2.7.4


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

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

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-24 20:30 Adding cacosl.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).