This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: patch to add C99 complex - 3/3


3/3 , second half of libm/complex

Regards
Marco


      
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cephes_subr.h src_new/newlib/libm/complex/cephes_subr.h
--- src/newlib/libm/complex/cephes_subr.h	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cephes_subr.h	2010-10-06 12:20:46.260220900 +0200
@@ -0,0 +1,5 @@
+/* $NetBSD: cephes_subr.h,v 1.1 2007/08/20 16:01:33 drochner Exp $ */
+
+void _cchsh(double, double *, double *);
+double _redupi(double);
+double _ctans(double complex);
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cephes_subrf.c src_new/newlib/libm/complex/cephes_subrf.c
--- src/newlib/libm/complex/cephes_subrf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cephes_subrf.c	2010-10-06 12:20:46.275846500 +0200
@@ -0,0 +1,125 @@
+/* $NetBSD: cephes_subrf.c,v 1.1 2007/08/20 16:01:34 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subrf.h"
+
+/* calculate cosh and sinh */
+
+void
+_cchshf(float x, float *c, float *s)
+{
+	float e, ei;
+
+	if (fabsf(x) <= 0.5f) {
+		*c = coshf(x);
+		*s = sinhf(x);
+	} else {
+		e = expf(x);
+		ei = 0.5f / e;
+		e = 0.5f * e;
+		*s = e - ei;
+		*c = e + ei;
+	}
+}
+
+/* Program to subtract nearest integer multiple of PI */
+
+/* extended precision value of PI: */
+static const double DP1 =  3.140625;
+static const double DP2 =  9.67502593994140625E-4;
+static const double DP3 =  1.509957990978376432E-7;
+#define MACHEPF 3.0e-8
+
+float
+_redupif(float x)
+{
+	float t;
+	long i;
+
+	t = x / (float)M_PI;
+	if (t >= 0.0f)
+		t += 0.5f;
+	else
+		t -= 0.5f;
+
+	i = t;	/* the multiple */
+	t = i;
+	t = ((x - t * DP1) - t * DP2) - t * DP3;
+	return t;
+}
+
+/* Taylor series expansion for cosh(2y) - cos(2x) */
+
+float
+_ctansf(float complex z)
+{
+	float f, x, x2, y, y2, rn, t, d;
+
+	x = fabsf(2.0f * crealf(z));
+	y = fabsf(2.0f * cimagf(z));
+
+	x = _redupif(x);
+
+	x = x * x;
+	y = y * y;
+	x2 = 1.0f;
+	y2 = 1.0f;
+	f = 1.0f;
+	rn = 0.0f;
+	d = 0.0f;
+	do {
+		rn += 1.0f;
+		f *= rn;
+		rn += 1.0f;
+		f *= rn;
+		x2 *= x;
+		y2 *= y;
+		t = y2 + x2;
+		t /= f;
+		d += t;
+
+		rn += 1.0f;
+		f *= rn;
+		rn += 1.0f;
+		f *= rn;
+		x2 *= x;
+		y2 *= y;
+		t = y2 - x2;
+		t /= f;
+		d += t;
+	} while (fabsf(t/d) > MACHEPF);
+	return d;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cephes_subrf.h src_new/newlib/libm/complex/cephes_subrf.h
--- src/newlib/libm/complex/cephes_subrf.h	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cephes_subrf.h	2010-10-06 12:20:46.338348900 +0200
@@ -0,0 +1,5 @@
+/* $NetBSD: cephes_subrf.h,v 1.1 2007/08/20 16:01:34 drochner Exp $ */
+
+void _cchshf(float, float *, float *);
+float _redupif(float);
+float _ctansf(float complex);
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cexp.c src_new/newlib/libm/complex/cexp.c
--- src/newlib/libm/complex/cexp.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cexp.c	2010-10-06 12:20:46.353974500 +0200
@@ -0,0 +1,49 @@
+/* $NetBSD: cexp.c,v 1.1 2007/08/20 16:01:34 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+cexp(double complex z)
+{
+	double complex w;
+	double r, x, y;
+
+	x = creal(z);
+	y = cimag(z);
+	r = exp(x);
+	w = r * cos(y) + r * sin(y) * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cexpf.c src_new/newlib/libm/complex/cexpf.c
--- src/newlib/libm/complex/cexpf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cexpf.c	2010-10-06 12:20:46.385225700 +0200
@@ -0,0 +1,49 @@
+/* $NetBSD: cexpf.c,v 1.1 2007/08/20 16:01:34 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+cexpf(float complex z)
+{
+	float complex w;
+	float r, x, y;
+
+	x = crealf(z);
+	y = cimagf(z);
+	r = expf(x);
+	w = r * cosf(y) + r * sinf(y) * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cimag.c src_new/newlib/libm/complex/cimag.c
--- src/newlib/libm/complex/cimag.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cimag.c	2010-10-06 12:20:46.432102500 +0200
@@ -0,0 +1,20 @@
+/* $NetBSD: cimag.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+double
+cimag(double complex z)
+{
+	double_complex w = { .z = z };
+
+	return (IMAG_PART(w));
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cimagf.c src_new/newlib/libm/complex/cimagf.c
--- src/newlib/libm/complex/cimagf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cimagf.c	2010-10-06 12:20:46.510230500 +0200
@@ -0,0 +1,20 @@
+/* $NetBSD: cimagf.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+float
+cimagf(float complex z)
+{
+	float_complex w = { .z = z };
+
+	return (IMAG_PART(w));
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/clog.c src_new/newlib/libm/complex/clog.c
--- src/newlib/libm/complex/clog.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/clog.c	2010-10-06 12:20:46.525856100 +0200
@@ -0,0 +1,49 @@
+/* $NetBSD: clog.c,v 1.1 2007/08/20 16:01:35 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+clog(double complex z)
+{
+	double complex w;
+	double p, rr;
+
+	rr = cabs(z);
+	p = log(rr);
+	rr = atan2(cimag(z), creal(z));
+	w = p + rr * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/clogf.c src_new/newlib/libm/complex/clogf.c
--- src/newlib/libm/complex/clogf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/clogf.c	2010-10-06 12:20:46.541481700 +0200
@@ -0,0 +1,49 @@
+/* $NetBSD: clogf.c,v 1.1 2007/08/20 16:01:35 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+clogf(float complex z)
+{
+	float complex w;
+	float p, rr;
+
+	rr = cabsf(z);
+	p = logf(rr);
+	rr = atan2f(cimagf(z), crealf(z));
+	w = p + rr * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/conj.c src_new/newlib/libm/complex/conj.c
--- src/newlib/libm/complex/conj.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/conj.c	2010-10-06 12:20:46.541481700 +0200
@@ -0,0 +1,22 @@
+/* $NetBSD: conj.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+double complex
+conj(double complex z)
+{
+	double_complex w = { .z = z };
+
+	IMAG_PART(w) = -IMAG_PART(w);
+
+	return (w.z);
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/conjf.c src_new/newlib/libm/complex/conjf.c
--- src/newlib/libm/complex/conjf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/conjf.c	2010-10-06 12:20:46.557107300 +0200
@@ -0,0 +1,22 @@
+/* $NetBSD: conjf.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+float complex
+conjf(float complex z)
+{
+	float_complex w = { .z = z };
+
+	IMAG_PART(w) = -IMAG_PART(w);
+
+	return (w.z);
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cpow.c src_new/newlib/libm/complex/cpow.c
--- src/newlib/libm/complex/cpow.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cpow.c	2010-10-06 12:20:46.572732900 +0200
@@ -0,0 +1,59 @@
+/* $NetBSD: cpow.c,v 1.1 2007/08/20 16:01:35 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+cpow(double complex a, double complex z)
+{
+	double complex w;
+	double x, y, r, theta, absa, arga;
+
+	x = creal(z);
+	y = cimag(z);
+	absa = cabs(a);
+	if (absa == 0.0) {
+		return (0.0 + 0.0 * I);
+	}
+	arga = carg(a);
+	r = pow(absa, x);
+	theta = x * arga;
+	if (y != 0.0) {
+		r = r * exp(-y * arga);
+		theta = theta + y * log(absa);
+	}
+	w = r * cos(theta) + (r * sin(theta)) * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cpowf.c src_new/newlib/libm/complex/cpowf.c
--- src/newlib/libm/complex/cpowf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cpowf.c	2010-10-06 12:20:46.588358500 +0200
@@ -0,0 +1,59 @@
+/* $NetBSD: cpowf.c,v 1.1 2007/08/20 16:01:36 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+cpowf(float complex a, float complex z)
+{
+	float complex w;
+	float x, y, r, theta, absa, arga;
+
+	x = crealf(z);
+	y = cimagf(z);
+	absa = cabsf(a);
+	if (absa == 0.0f) {
+		return (0.0f + 0.0f * I);
+	}
+	arga = cargf(a);
+	r = powf(absa, x);
+	theta = x * arga;
+	if (y != 0.0f) {
+		r = r * expf(-y * arga);
+		theta = theta + y * logf(absa);
+	}
+	w = r * cosf(theta) + (r * sinf(theta)) * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cproj.c src_new/newlib/libm/complex/cproj.c
--- src/newlib/libm/complex/cproj.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cproj.c	2010-10-06 12:20:46.635235300 +0200
@@ -0,0 +1,67 @@
+/*	$NetBSD: cproj.c,v 1.3 2010/09/20 17:51:38 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <sys/cdefs.h>
+/*__RCSID("$NetBSD: cproj.c,v 1.3 2010/09/20 17:51:38 christos Exp $"); */
+
+#include <complex.h>
+#include <math.h>
+
+#include "../common/fdlibm.h"
+
+/*
+ * cproj(double complex z)
+ *
+ * These functions return the value of the projection (not stereographic!)
+ * onto the Riemann sphere.
+ *
+ * z projects to z, except that all complex infinities (even those with one
+ * infinite part and one NaN part) project to positive infinity on the real axis.
+ * If z has an infinite part, then cproj(z) shall be equivalent to:
+ *
+ * INFINITY + I * copysign(0.0, cimag(z))
+ */
+double complex
+cproj(double complex z)
+{
+	double_complex w = { .z = z };
+
+	if (isinf(creal(z) || isinf(cimag(z)))) {
+#ifdef __INFINITY
+		REAL_PART(w) = __INFINITY;
+#else
+		REAL_PART(w) = INFINITY;
+#endif
+		IMAG_PART(w) = copysign(0.0, cimag(z));
+	}
+
+	return (w.z);
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/cprojf.c src_new/newlib/libm/complex/cprojf.c
--- src/newlib/libm/complex/cprojf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/cprojf.c	2010-10-06 12:20:46.650860900 +0200
@@ -0,0 +1,68 @@
+/*	$NetBSD: cprojf.c,v 1.3 2010/09/20 17:51:38 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <sys/cdefs.h>
+/*__RCSID("$NetBSD: cprojf.c,v 1.3 2010/09/20 17:51:38 christos Exp $"); */
+
+#include <complex.h>
+#include <math.h>
+
+#include "../common/fdlibm.h"
+
+/*
+ * cprojf(float complex z)
+ *
+ * These functions return the value of the projection (not stereographic!)
+ * onto the Riemann sphere.
+ *
+ * z projects to z, except that all complex infinities (even those with one
+ * infinite part and one NaN part) project to positive infinity on the real axis.
+ * If z has an infinite part, then cproj(z) shall be equivalent to:
+ *
+ * INFINITY + I * copysign(0.0, cimag(z))
+ */
+
+float complex
+cprojf(float complex z)
+{
+	float_complex w = { .z = z };
+
+	if (isinf(crealf(z) || isinf(cimagf(z)))) {
+#ifdef __INFINITY
+		REAL_PART(w) = __INFINITY;
+#else
+		REAL_PART(w) = INFINITY;
+#endif
+		IMAG_PART(w) = copysignf(0.0, cimagf(z));
+	}
+
+	return (w.z);
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/creal.c src_new/newlib/libm/complex/creal.c
--- src/newlib/libm/complex/creal.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/creal.c	2010-10-06 12:20:46.682112100 +0200
@@ -0,0 +1,20 @@
+/* $NetBSD: creal.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+double
+creal(double complex z)
+{
+	double_complex w = { .z = z };
+
+	return (REAL_PART(w));
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/crealf.c src_new/newlib/libm/complex/crealf.c
--- src/newlib/libm/complex/crealf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/crealf.c	2010-10-06 12:20:46.697737700 +0200
@@ -0,0 +1,20 @@
+/* $NetBSD: crealf.c,v 1.2 2010/09/15 16:11:29 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner <drochner@NetBSD.org>.
+ * Public domain.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include "../common/fdlibm.h"
+
+float
+crealf(float complex z)
+{
+	float_complex w = { .z = z };
+
+	return (REAL_PART(w));
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/csin.c src_new/newlib/libm/complex/csin.c
--- src/newlib/libm/complex/csin.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/csin.c	2010-10-06 12:20:46.728988900 +0200
@@ -0,0 +1,48 @@
+/* $NetBSD: csin.c,v 1.1 2007/08/20 16:01:36 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subr.h"
+
+double complex
+csin(double complex z)
+{
+	double complex w;
+	double ch, sh;
+
+	_cchsh(cimag(z), &ch, &sh);
+	w = sin(creal(z)) * ch + (cos(creal(z)) * sh) * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/csinf.c src_new/newlib/libm/complex/csinf.c
--- src/newlib/libm/complex/csinf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/csinf.c	2010-10-06 12:20:46.744614500 +0200
@@ -0,0 +1,48 @@
+/* $NetBSD: csinf.c,v 1.1 2007/08/20 16:01:36 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subrf.h"
+
+float complex
+csinf(float complex z)
+{
+	float complex w;
+	float ch, sh;
+
+	_cchshf(cimagf(z), &ch, &sh);
+	w = sinf(crealf(z)) * ch + (cosf(crealf(z)) * sh) * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/csinh.c src_new/newlib/libm/complex/csinh.c
--- src/newlib/libm/complex/csinh.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/csinh.c	2010-10-06 12:20:46.760240100 +0200
@@ -0,0 +1,48 @@
+/* $NetBSD: csinh.c,v 1.1 2007/08/20 16:01:36 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+csinh(double complex z)
+{
+	double complex w;
+	double x, y;
+
+	x = creal(z);
+	y = cimag(z);
+	w = sinh(x) * cos(y) + (cosh(x) * sin(y)) * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/csinhf.c src_new/newlib/libm/complex/csinhf.c
--- src/newlib/libm/complex/csinhf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/csinhf.c	2010-10-06 12:20:46.807116900 +0200
@@ -0,0 +1,48 @@
+/* $NetBSD: csinhf.c,v 1.1 2007/08/20 16:01:37 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+csinhf(float complex z)
+{
+	float complex w;
+	float x, y;
+
+	x = crealf(z);
+	y = cimagf(z);
+	w = sinhf(x) * cosf(y) + (coshf(x) * sinf(y)) * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/csqrt.c src_new/newlib/libm/complex/csqrt.c
--- src/newlib/libm/complex/csqrt.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/csqrt.c	2010-10-06 12:20:46.807116900 +0200
@@ -0,0 +1,102 @@
+/* $NetBSD: csqrt.c,v 1.1 2007/08/20 16:01:37 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+csqrt(double complex z)
+{
+	double complex w;
+	double x, y, r, t, scale;
+
+	x = creal (z);
+	y = cimag (z);
+
+	if (y == 0.0) {
+		if (x == 0.0) {
+			w = 0.0 + y * I;
+		} else {
+			r = fabs(x);
+			r = sqrt(r);
+			if (x < 0.0) {
+				w = 0.0 + r * I;
+			} else {
+				w = r + y * I;
+			}
+		}
+		return w;
+	}
+	if (x == 0.0) {
+		r = fabs(y);
+		r = sqrt(0.5 * r);
+		if (y > 0)
+			w = r + r * I;
+		else
+			w = r - r * I;
+		return w;
+	}
+	/* Rescale to avoid internal overflow or underflow.  */
+	if ((fabs(x) > 4.0) || (fabs(y) > 4.0)) {
+		x *= 0.25;
+		y *= 0.25;
+		scale = 2.0;
+	} else {
+#if 1
+		x *= 1.8014398509481984e16;  /* 2^54 */
+		y *= 1.8014398509481984e16;
+		scale = 7.450580596923828125e-9; /* 2^-27 */
+#else
+		x *= 4.0;
+		y *= 4.0;
+		scale = 0.5;
+#endif
+	}
+	w = x + y * I;
+	r = cabs(w);
+	if (x > 0) {
+		t = sqrt(0.5 * r + 0.5 * x);
+		r = scale * fabs((0.5 * y) / t );
+		t *= scale;
+	} else {
+		r = sqrt(0.5 * r - 0.5 * x);
+		t = scale * fabs((0.5 * y) / r);
+		r *= scale;
+	}
+	if (y < 0)
+		w = t - r * I;
+	else
+		w = t + r * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/csqrtf.c src_new/newlib/libm/complex/csqrtf.c
--- src/newlib/libm/complex/csqrtf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/csqrtf.c	2010-10-06 12:20:46.822742500 +0200
@@ -0,0 +1,102 @@
+/* $NetBSD: csqrtf.c,v 1.1 2007/08/20 16:01:37 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+csqrtf(float complex z)
+{
+	float complex w;
+	float x, y, r, t, scale;
+
+	x = crealf (z);
+	y = cimagf (z);
+
+	if (y == 0.0f) {
+		if (x < 0.0f) {
+			w = 0.0f + sqrtf(-x) * I;
+			return w;
+		} else if (x == 0.0f) {
+			return (0.0f + y * I);
+		} else {
+			w = sqrtf(x) + y * I;
+			return w;
+		}
+	}
+
+	if (x == 0.0f) {
+		r = fabsf(y);
+		r = sqrtf(0.5f * r);
+		if (y > 0)
+			w = r + r * I;
+		else
+			w = r - r * I;
+		return w;
+	}
+
+	/* Rescale to avoid internal overflow or underflow.  */
+	if ((fabsf(x) > 4.0f) || (fabsf(y) > 4.0f)) {
+		x *= 0.25f;
+		y *= 0.25f;
+		scale = 2.0f;
+	} else {
+#if 1
+		x *= 6.7108864e7f; /* 2^26 */
+		y *= 6.7108864e7f;
+		scale = 1.220703125e-4f; /* 2^-13 */
+#else
+		x *= 4.0f;
+		y *= 4.0f;
+		scale = 0.5f;
+#endif
+	}
+	w = x + y * I;
+	r = cabsf(w);
+	if( x > 0 ) {
+		t = sqrtf(0.5f * r + 0.5f * x);
+		r = scale * fabsf((0.5f * y) / t);
+		t *= scale;
+	} else {
+		r = sqrtf(0.5f * r - 0.5f * x);
+		t = scale * fabsf((0.5f * y) / r);
+		r *= scale;
+	}
+
+	if (y < 0)
+		w = t - r * I;
+	else
+		w = t + r * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/ctan.c src_new/newlib/libm/complex/ctan.c
--- src/newlib/libm/complex/ctan.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/ctan.c	2010-10-06 12:20:46.838368100 +0200
@@ -0,0 +1,60 @@
+/* $NetBSD: ctan.c,v 1.1 2007/08/20 16:01:37 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subr.h"
+
+#define MAXNUM 1.0e308
+
+double complex
+ctan(double complex z)
+{
+	double complex w;
+	double d;
+
+	d = cos(2.0 * creal(z)) + cosh(2.0 * cimag(z));
+
+	if (fabs(d) < 0.25)
+		d = _ctans(z);
+
+	if (d == 0.0) {
+		/* mtherr ("ctan", OVERFLOW); */
+		w = MAXNUM + MAXNUM * I;
+		return w;
+	}
+
+	w = sin(2.0 * creal(z)) / d + (sinh(2.0 * cimag(z)) / d) * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/ctanf.c src_new/newlib/libm/complex/ctanf.c
--- src/newlib/libm/complex/ctanf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/ctanf.c	2010-10-06 12:20:46.853993700 +0200
@@ -0,0 +1,60 @@
+/* $NetBSD: ctanf.c,v 1.1 2007/08/20 16:01:38 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+#include "cephes_subrf.h"
+
+#define MAXNUMF 1.0e38f
+
+float complex
+ctanf(float complex z)
+{
+	float complex w;
+	float d;
+
+	d = cosf(2.0f * crealf(z)) + coshf(2.0f * cimagf(z));
+
+	if (fabsf(d) < 0.25f)
+		d = _ctansf(z);
+
+	if (d == 0.0f) {
+		/* mtherr ("ctan", OVERFLOW); */
+		w = MAXNUMF + MAXNUMF * I;
+		return w;
+	}
+
+	w = sinf(2.0f * crealf(z)) / d + (sinhf(2.0f * cimagf(z)) / d) * I;
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/ctanh.c src_new/newlib/libm/complex/ctanh.c
--- src/newlib/libm/complex/ctanh.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/ctanh.c	2010-10-06 12:20:46.869619300 +0200
@@ -0,0 +1,50 @@
+/* $NetBSD: ctanh.c,v 1.1 2007/08/20 16:01:38 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+double complex
+ctanh(double complex z)
+{
+	double complex w;
+	double x, y, d;
+
+	x = creal(z);
+	y = cimag(z);
+	d = cosh(2.0 * x) + cos(2.0 * y);
+	w = sinh(2.0 * x) / d  +  (sin(2.0 * y) / d) * I;
+
+	return w;
+}
diff -uNr -x Makefile.in -x '*~' -x '*.m4' -x autom4te.cache -x configure src/newlib/libm/complex/ctanhf.c src_new/newlib/libm/complex/ctanhf.c
--- src/newlib/libm/complex/ctanhf.c	1970-01-01 01:00:00.000000000 +0100
+++ src_new/newlib/libm/complex/ctanhf.c	2010-10-06 12:20:46.916496100 +0200
@@ -0,0 +1,50 @@
+/* $NetBSD: ctanhf.c,v 1.1 2007/08/20 16:01:38 drochner 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.
+ *
+ * imported and modified include for newlib 2010/10/03 
+ * Marco Atzeri <marco_atzeri@yahoo.it>
+ */
+
+#include <complex.h>
+#include <math.h>
+
+float complex
+ctanhf(float complex z)
+{
+	float complex w;
+	float x, y, d;
+
+	x = crealf(z);
+	y = cimagf(z);
+	d = coshf(2.0f * x) + cosf(2.0f * y);
+	w = sinhf(2.0f * x) / d  +  (sinf(2.0f * y) / d) * I;
+
+	return w;
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]