Module Name: src
Committed By: martin
Date: Mon Oct 13 19:34:58 UTC 2014
Modified Files:
src/lib/libm [netbsd-7]: Makefile shlib_version
src/lib/libm/arch/vax [netbsd-7]: n_atan2.S n_cabs.S n_sincos.S
n_sqrt.S
src/lib/libm/complex [netbsd-7]: Makefile.inc cprojl.c
src/lib/libm/man [netbsd-7]: acosh.3 asinh.3 atanh.3
src/lib/libm/noieee_src [netbsd-7]: n_atan2.c n_cosh.c n_exp.c n_log.c
n_pow.c n_sincos.c n_sinh.c
Added Files:
src/lib/libm/complex [netbsd-7]: cabsl.c cacoshl.c cacosl.c cargl.c
casinhl.c casinl.c catanhl.c catanl.c ccoshl.c ccosl.c
cephes_subrl.c cephes_subrl.h cexpl.c clogl.c cpowl.c csinhl.c
csinl.c csqrtl.c ctanhl.c ctanl.c
Log Message:
Pullup the following revisions, requested by christos in #138:
src/lib/libm/Makefile 1.165-1.166
src/lib/libm/shlib_version 1.14
src/lib/libm/arch/vax/n_atan2.S 1.9
src/lib/libm/arch/vax/n_cabs.S 1.7
src/lib/libm/arch/vax/n_sincos.S 1.9
src/lib/libm/arch/vax/n_sqrt.S 1.10-1.11
src/lib/libm/complex/Makefile.inc 1.5-1.8
src/lib/libm/complex/cabsl.c 1.1
src/lib/libm/complex/cacoshl.c 1.1
src/lib/libm/complex/cacosl.c 1.1
src/lib/libm/complex/cargl.c 1.1
src/lib/libm/complex/casinhl.c 1.1
src/lib/libm/complex/casinl.c 1.1
src/lib/libm/complex/catanhl.c 1.1
src/lib/libm/complex/catanl.c 1.1
src/lib/libm/complex/ccoshl.c 1.1
src/lib/libm/complex/ccosl.c 1.1
src/lib/libm/complex/cephes_subrl.c 1.1
src/lib/libm/complex/cephes_subrl.h 1.1
src/lib/libm/complex/cexpl.c 1.1
src/lib/libm/complex/clogl.c 1.1
src/lib/libm/complex/cpowl.c 1.1
src/lib/libm/complex/cprojl.c 1.7
src/lib/libm/complex/csinhl.c 1.1
src/lib/libm/complex/csinl.c 1.1
src/lib/libm/complex/csqrtl.c 1.1
src/lib/libm/complex/ctanhl.c 1.1
src/lib/libm/complex/ctanl.c 1.1
src/lib/libm/man/acosh.3 1.17
src/lib/libm/man/asinh.3 1.17
src/lib/libm/man/atanh.3 1.17
src/lib/libm/noieee_src/n_atan2.c 1.7
src/lib/libm/noieee_src/n_cosh.c 1.9
src/lib/libm/noieee_src/n_exp.c 1.9
src/lib/libm/noieee_src/n_log.c 1.8
src/lib/libm/noieee_src/n_pow.c 1.10-1.11
src/lib/libm/noieee_src/n_sincos.c 1.7
src/lib/libm/noieee_src/n_sinh.c 1.8
Import the missing complex support routines from FreeBSD so we can
enable C++ 2011 mode for libstc++.
To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.164.2.1 src/lib/libm/Makefile
cvs rdiff -u -r1.13 -r1.13.20.1 src/lib/libm/shlib_version
cvs rdiff -u -r1.8 -r1.8.42.1 src/lib/libm/arch/vax/n_atan2.S
cvs rdiff -u -r1.6 -r1.6.42.1 src/lib/libm/arch/vax/n_cabs.S
cvs rdiff -u -r1.8 -r1.8.74.1 src/lib/libm/arch/vax/n_sincos.S
cvs rdiff -u -r1.9 -r1.9.4.1 src/lib/libm/arch/vax/n_sqrt.S
cvs rdiff -u -r1.4 -r1.4.22.1 src/lib/libm/complex/Makefile.inc
cvs rdiff -u -r0 -r1.1.2.2 src/lib/libm/complex/cabsl.c \
src/lib/libm/complex/cacoshl.c src/lib/libm/complex/cacosl.c \
src/lib/libm/complex/cargl.c src/lib/libm/complex/casinhl.c \
src/lib/libm/complex/casinl.c src/lib/libm/complex/catanl.c \
src/lib/libm/complex/ccoshl.c src/lib/libm/complex/ccosl.c \
src/lib/libm/complex/cephes_subrl.h src/lib/libm/complex/cexpl.c \
src/lib/libm/complex/clogl.c src/lib/libm/complex/cpowl.c \
src/lib/libm/complex/csinhl.c src/lib/libm/complex/csinl.c \
src/lib/libm/complex/ctanhl.c src/lib/libm/complex/ctanl.c
cvs rdiff -u -r0 -r1.3.2.2 src/lib/libm/complex/catanhl.c
cvs rdiff -u -r0 -r1.2.2.2 src/lib/libm/complex/cephes_subrl.c \
src/lib/libm/complex/csqrtl.c
cvs rdiff -u -r1.6 -r1.6.20.1 src/lib/libm/complex/cprojl.c
cvs rdiff -u -r1.16 -r1.16.8.1 src/lib/libm/man/acosh.3 \
src/lib/libm/man/asinh.3 src/lib/libm/man/atanh.3
cvs rdiff -u -r1.6 -r1.6.74.1 src/lib/libm/noieee_src/n_atan2.c \
src/lib/libm/noieee_src/n_sincos.c
cvs rdiff -u -r1.8 -r1.8.42.1 src/lib/libm/noieee_src/n_cosh.c \
src/lib/libm/noieee_src/n_exp.c
cvs rdiff -u -r1.7 -r1.7.42.1 src/lib/libm/noieee_src/n_log.c \
src/lib/libm/noieee_src/n_sinh.c
cvs rdiff -u -r1.9 -r1.9.4.1 src/lib/libm/noieee_src/n_pow.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libm/Makefile
diff -u src/lib/libm/Makefile:1.164 src/lib/libm/Makefile:1.164.2.1
--- src/lib/libm/Makefile:1.164 Mon Aug 11 08:20:57 2014
+++ src/lib/libm/Makefile Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.164 2014/08/11 08:20:57 mrg Exp $
+# $NetBSD: Makefile,v 1.164.2.1 2014/10/13 19:34:58 martin Exp $
#
# @(#)Makefile 5.1beta 93/09/24
#
@@ -66,17 +66,14 @@ COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
ARCH_SRCS = s_copysign.S s_copysignf.S lrint.S
COPTS+= -mfloat-ieee -mieee-with-inexact -mfp-trap-mode=sui -mtrap-precision=i
.elif (${LIBC_MACHINE_CPU} == "arm")
-.PATH: ${.CURDIR}/arch/arm
+.PATH.c: ${.CURDIR}/arch/arm
COMMON_SRCS+= fenv.c s_nexttowardf.c \
s_nearbyint.c s_rintl.c
COPTS.e_sqrtl.c += -DHAVE_FENV_H
COPTS.fenv.c+= -mfpu=vfp
.if (${MKSOFTFLOAT} == "no")
+.PATH.S: ${.CURDIR}/arch/arm
ARCH_SRCS = e_sqrt.S e_sqrtf.S lrint.S lrintf.S s_fabsf.S s_fma.S s_fmaf.S
-.else
-.for i in e_sqrt.o e_sqrtf.o lrint.o lrintf.o s_fabsf.o s_fma.o s_fmaf.o
-${i} ${i:.o=.po} ${i:.o=.pico} ${i:.o=.go} ${i:.o=.ln}: ${i:.o=.c}
-.endfor
.endif
.elif (${LIBC_MACHINE_ARCH} == "sparc")
.PATH: ${.CURDIR}/arch/sparc
@@ -150,6 +147,19 @@ ARCH_SRCS = e_acos.S e_asin.S e_atanh.S
# and emulation code isn't written yet.
ARCH_SRCS = n_scalbn.S
WARNS?=5
+.elif (${LIBC_MACHINE_CPU} == "riscv")
+.PATH: ${.CURDIR}/arch/riscv
+
+COMMON_SRCS += fenv.c
+
+.if ${MKSOFTFLOAT} == "no"
+ARCH_SRCS = e_sqrt.S e_sqrtf.S
+ARCH_SRCS += s_copysign.S s_copysignf.S
+ARCH_SRCS += s_fabs.S s_fabsf.S
+ARCH_SRCS += s_fma.S s_fmaf.S
+ARCH_SRCS += s_fmax.S s_fmaxf.S
+ARCH_SRCS += s_fmin.S s_fminf.S
+.endif
.endif
WARNS?=5
Index: src/lib/libm/shlib_version
diff -u src/lib/libm/shlib_version:1.13 src/lib/libm/shlib_version:1.13.20.1
--- src/lib/libm/shlib_version:1.13 Tue Jul 26 16:10:16 2011
+++ src/lib/libm/shlib_version Mon Oct 13 19:34:58 2014
@@ -1,5 +1,5 @@
-# $NetBSD: shlib_version,v 1.13 2011/07/26 16:10:16 joerg Exp $
+# $NetBSD: shlib_version,v 1.13.20.1 2014/10/13 19:34:58 martin Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
major=0
-minor=10
+minor=11
Index: src/lib/libm/arch/vax/n_atan2.S
diff -u src/lib/libm/arch/vax/n_atan2.S:1.8 src/lib/libm/arch/vax/n_atan2.S:1.8.42.1
--- src/lib/libm/arch/vax/n_atan2.S:1.8 Thu Mar 20 18:49:39 2008
+++ src/lib/libm/arch/vax/n_atan2.S Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_atan2.S,v 1.8 2008/03/20 18:49:39 mhitch Exp $ */
+/* $NetBSD: n_atan2.S,v 1.8.42.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -84,6 +84,7 @@ ENTRY(_atan2f, 0)
#ifdef WEAK_ALIAS
WEAK_ALIAS(atan2, _atan2)
+WEAK_ALIAS(_atan2l, _atan2)
#endif
ENTRY(_atan2, 0x0fc0)
Index: src/lib/libm/arch/vax/n_cabs.S
diff -u src/lib/libm/arch/vax/n_cabs.S:1.6 src/lib/libm/arch/vax/n_cabs.S:1.6.42.1
--- src/lib/libm/arch/vax/n_cabs.S:1.6 Thu Mar 20 16:41:26 2008
+++ src/lib/libm/arch/vax/n_cabs.S Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_cabs.S,v 1.6 2008/03/20 16:41:26 mhitch Exp $ */
+/* $NetBSD: n_cabs.S,v 1.6.42.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -55,6 +55,8 @@ ENTRY(_hypotf, 0)
#ifdef WEAK_ALIAS
WEAK_ALIAS(hypot, _hypot)
+WEAK_ALIAS(hypotl, _hypot)
+WEAK_ALIAS(_hypotl, _hypot)
#endif
ALTENTRY(cabs)
Index: src/lib/libm/arch/vax/n_sincos.S
diff -u src/lib/libm/arch/vax/n_sincos.S:1.8 src/lib/libm/arch/vax/n_sincos.S:1.8.74.1
--- src/lib/libm/arch/vax/n_sincos.S:1.8 Thu Aug 7 16:44:45 2003
+++ src/lib/libm/arch/vax/n_sincos.S Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_sincos.S,v 1.8 2003/08/07 16:44:45 agc Exp $ */
+/* $NetBSD: n_sincos.S,v 1.8.74.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -52,6 +52,10 @@ ENTRY(sinf, 0)
cvtdf %r0,%r0
ret
+#ifdef WEAK_ALIAS
+WEAK_ALIAS(_sinl, sin)
+#endif
+
ENTRY(sin, 0xfc0)
movq 4(%ap),%r0
bicw3 $0x807f,%r0,%r2
@@ -87,6 +91,10 @@ ENTRY(cosf, 0)
cvtdf %r0,%r0
ret
+#ifdef WEAK_ALIAS
+WEAK_ALIAS(_cosl, cos)
+#endif
+
ENTRY(cos, 0x0fc0)
movq 4(%ap),%r0
bicw3 $0x7f,%r0,%r2
Index: src/lib/libm/arch/vax/n_sqrt.S
diff -u src/lib/libm/arch/vax/n_sqrt.S:1.9 src/lib/libm/arch/vax/n_sqrt.S:1.9.4.1
--- src/lib/libm/arch/vax/n_sqrt.S:1.9 Thu Mar 6 11:00:17 2014
+++ src/lib/libm/arch/vax/n_sqrt.S Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_sqrt.S,v 1.9 2014/03/06 11:00:17 martin Exp $ */
+/* $NetBSD: n_sqrt.S,v 1.9.4.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,6 +33,7 @@
#include <machine/asm.h>
#ifdef WEAK_ALIAS
+WEAK_ALIAS(_sqrtl, sqrt)
WEAK_ALIAS(sqrtl, sqrt)
#endif
Index: src/lib/libm/complex/Makefile.inc
diff -u src/lib/libm/complex/Makefile.inc:1.4 src/lib/libm/complex/Makefile.inc:1.4.22.1
--- src/lib/libm/complex/Makefile.inc:1.4 Fri Mar 18 00:57:22 2011
+++ src/lib/libm/complex/Makefile.inc Mon Oct 13 19:34:58 2014
@@ -1,29 +1,14 @@
-# $NetBSD: Makefile.inc,v 1.4 2011/03/18 00:57:22 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.4.22.1 2014/10/13 19:34:58 martin Exp $
.PATH: ${.CURDIR}/complex
-SRCS+= cabs.c cabsf.c carg.c cargf.c
-SRCS+= creal.c crealf.c creall.c cimag.c cimagf.c cimagl.c
-SRCS+= conj.c conjf.c conjl.c
-SRCS+= csqrt.c cexp.c clog.c cpow.c
-SRCS+= cephes_subr.c csin.c ccos.c ctan.c csinh.c ccosh.c ctanh.c
-SRCS+= casin.c cacos.c catan.c casinh.c cacosh.c catanh.c
-SRCS+= csqrtf.c cexpf.c clogf.c cpowf.c
-SRCS+= cephes_subrf.c csinf.c ccosf.c ctanf.c csinhf.c ccoshf.c ctanhf.c
-SRCS+= casinf.c cacosf.c catanf.c casinhf.c cacoshf.c catanhf.c
-SRCS+= cproj.c cprojf.c cprojl.c
+COMPLEX_SRCS = cabs.c cacos.c cacosh.c carg.c casin.c casinh.c catan.c \
+ ccos.c ccosh.c cephes_subr.c cexp.c clog.c conj.c cpow.c cproj.c \
+ cimag.c creal.c csin.c csinh.c csqrt.c ctan.c ctanh.c catanh.c
-MAN+= cabs.3 cacos.3 cacosh.3 carg.3 casin.3 casinh.3 catan.3 catanh.3
-MAN+= ccos.3 ccosh.3 cexp.3 cimag.3 clog.3 conj.3 cpow.3 cproj.3 creal.3
-MAN+= csin.3 csinh.3 csqrt.3 ctan.3 ctanh.3
-
-MLINKS+= cabs.3 cabsf.3 cacos.3 cacosf.3 cacosh.3 cacoshf.3
-MLINKS+= carg.3 cargf.3 casin.3 casinf.3 casinh.3 casinhf.3
-MLINKS+= catan.3 catanf.3 catanh.3 catanhf.3 ccos.3 ccosf.3
-MLINKS+= ccosh.3 ccoshf.3 cexp.3 cexpf.3
-MLINKS+= cimag.3 cimagf.3 cimag.3 cimagl.3
-MLINKS+= clog.3 clogf.3 conj.3 conjf.3 conj.3 conjl.3 cpow.3 cpowf.3
-MLINKS+= cproj.3 cprojf.3 cproj.3 cprojl.3
-MLINKS+= creal.3 crealf.3 creal.3 creall.3
-MLINKS+= csin.3 csinf.3 csinh.3 csinhf.3
-MLINKS+= csqrt.3 csqrtf.3 ctan.3 ctanf.3 ctanh.3 ctanhf.3
+.for i in ${COMPLEX_SRCS}
+SRCS+= $i ${i:S/.c/f.c/} ${i:S/.c/l.c/}
+MAN+= ${i:Ncephes_*:S/.c/.3/}
+MLINKS+= ${i:Ncephes_*:S/.c/.3/} ${i:Ncephes_*:S/.c/f.3/}
+MLINKS+= ${i:Ncephes_*:S/.c/.3/} ${i:Ncephes_*:S/.c/l.3/}
+.endfor
Index: src/lib/libm/complex/cprojl.c
diff -u src/lib/libm/complex/cprojl.c:1.6 src/lib/libm/complex/cprojl.c:1.6.20.1
--- src/lib/libm/complex/cprojl.c:1.6 Wed Nov 2 02:34:56 2011
+++ src/lib/libm/complex/cprojl.c Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: cprojl.c,v 1.6 2011/11/02 02:34:56 christos Exp $ */
+/* $NetBSD: cprojl.c,v 1.6.20.1 2014/10/13 19:34:58 martin Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: cprojl.c,v 1.6 2011/11/02 02:34:56 christos Exp $");
+__RCSID("$NetBSD: cprojl.c,v 1.6.20.1 2014/10/13 19:34:58 martin Exp $");
#include <complex.h>
#include <math.h>
@@ -57,7 +57,7 @@ cprojl(long double complex z)
#else
REAL_PART(w) = INFINITY;
#endif
- IMAG_PART(w) = copysignl(0.0, cimagl(z));
+ IMAG_PART(w) = copysignl(0.0L, cimagl(z));
}
return (w.z);
Index: src/lib/libm/man/acosh.3
diff -u src/lib/libm/man/acosh.3:1.16 src/lib/libm/man/acosh.3:1.16.8.1
--- src/lib/libm/man/acosh.3:1.16 Tue Jan 29 02:54:30 2013
+++ src/lib/libm/man/acosh.3 Mon Oct 13 19:34:58 2014
@@ -26,7 +26,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)acosh.3 5.2 (Berkeley) 5/6/91
-.\" $NetBSD: acosh.3,v 1.16 2013/01/29 02:54:30 matt Exp $
+.\" $NetBSD: acosh.3,v 1.16.8.1 2014/10/13 19:34:58 martin Exp $
.\"
.Dd January 29, 2013
.Dt ACOSH 3
@@ -75,13 +75,13 @@ to EDOM.
.Xr exp 3 ,
.Xr math 3
.\" .Xr matherr 3
-.Sh HISTORY
-The
-.Fn acosh
-function appeared in
-.Bx 4.3 .
.Sh STANDARDS
The
.Fn acosh
function conforms to
.St -isoC-99 .
+.Sh HISTORY
+The
+.Fn acosh
+function appeared in
+.Bx 4.3 .
Index: src/lib/libm/man/asinh.3
diff -u src/lib/libm/man/asinh.3:1.16 src/lib/libm/man/asinh.3:1.16.8.1
--- src/lib/libm/man/asinh.3:1.16 Tue Jan 29 02:54:30 2013
+++ src/lib/libm/man/asinh.3 Mon Oct 13 19:34:58 2014
@@ -26,7 +26,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)asinh.3 6.4 (Berkeley) 5/6/91
-.\" $NetBSD: asinh.3,v 1.16 2013/01/29 02:54:30 matt Exp $
+.\" $NetBSD: asinh.3,v 1.16.8.1 2014/10/13 19:34:58 martin Exp $
.\"
.Dd January 29, 2013
.Dt ASINH 3
@@ -73,13 +73,13 @@ functions return the inverse hyperbolic
.Xr exp 3 ,
.Xr math 3
.\" .Xr matherr 3
-.Sh HISTORY
-The
-.Fn asinh
-function appeared in
-.Bx 4.3 .
.Sh STANDARDS
The
.Fn asinh
function conforms to
.St -isoC-99 .
+.Sh HISTORY
+The
+.Fn asinh
+function appeared in
+.Bx 4.3 .
Index: src/lib/libm/man/atanh.3
diff -u src/lib/libm/man/atanh.3:1.16 src/lib/libm/man/atanh.3:1.16.8.1
--- src/lib/libm/man/atanh.3:1.16 Tue Jan 29 02:54:30 2013
+++ src/lib/libm/man/atanh.3 Mon Oct 13 19:34:58 2014
@@ -26,7 +26,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)atanh.3 5.2 (Berkeley) 5/6/91
-.\" $NetBSD: atanh.3,v 1.16 2013/01/29 02:54:30 matt Exp $
+.\" $NetBSD: atanh.3,v 1.16.8.1 2014/10/13 19:34:58 martin Exp $
.\"
.Dd January 29, 2013
.Dt ATANH 3
@@ -75,13 +75,13 @@ to EDOM.
.Xr exp 3 ,
.Xr math 3
.\" .Xr matherr 3
-.Sh HISTORY
-The
-.Fn atanh
-function appeared in
-.Bx 4.3 .
.Sh STANDARDS
The
.Fn atanh
function conforms to
.St -isoC-99 .
+.Sh HISTORY
+The
+.Fn atanh
+function appeared in
+.Bx 4.3 .
Index: src/lib/libm/noieee_src/n_atan2.c
diff -u src/lib/libm/noieee_src/n_atan2.c:1.6 src/lib/libm/noieee_src/n_atan2.c:1.6.74.1
--- src/lib/libm/noieee_src/n_atan2.c:1.6 Thu Aug 7 16:44:50 2003
+++ src/lib/libm/noieee_src/n_atan2.c Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_atan2.c,v 1.6 2003/08/07 16:44:50 agc Exp $ */
+/* $NetBSD: n_atan2.c,v 1.6.74.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -170,6 +170,10 @@ ic(a11, 1.6438029044759730479E-2 ,
#define a12 vccast(a12)
#endif
+#ifdef __weak_alias
+__weak_alias(_atan2l, atan2);
+#endif
+
double
atan2(double y, double x)
{
Index: src/lib/libm/noieee_src/n_sincos.c
diff -u src/lib/libm/noieee_src/n_sincos.c:1.6 src/lib/libm/noieee_src/n_sincos.c:1.6.74.1
--- src/lib/libm/noieee_src/n_sincos.c:1.6 Thu Aug 7 16:44:52 2003
+++ src/lib/libm/noieee_src/n_sincos.c Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_sincos.c,v 1.6 2003/08/07 16:44:52 agc Exp $ */
+/* $NetBSD: n_sincos.c,v 1.6.74.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1987, 1993
* The Regents of the University of California. All rights reserved.
@@ -38,6 +38,11 @@ static char sccsid[] = "@(#)sincos.c 8.1
#include "mathimpl.h"
#include "trig.h"
+#ifdef __weak_alias
+__weak_alias(_sinl, sin);
+__weak_alias(_cosl, cos);
+#endif
+
double
sin(double x)
{
Index: src/lib/libm/noieee_src/n_cosh.c
diff -u src/lib/libm/noieee_src/n_cosh.c:1.8 src/lib/libm/noieee_src/n_cosh.c:1.8.42.1
--- src/lib/libm/noieee_src/n_cosh.c:1.8 Thu Mar 20 16:41:26 2008
+++ src/lib/libm/noieee_src/n_cosh.c Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_cosh.c,v 1.8 2008/03/20 16:41:26 mhitch Exp $ */
+/* $NetBSD: n_cosh.c,v 1.8.42.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -87,6 +87,7 @@ static char sccsid[] = "@(#)cosh.c 8.1 (
#ifdef __weak_alias
__weak_alias(cosh, _cosh);
+__weak_alias(_coshl, _cosh);
__weak_alias(coshf, _coshf);
#endif
Index: src/lib/libm/noieee_src/n_exp.c
diff -u src/lib/libm/noieee_src/n_exp.c:1.8 src/lib/libm/noieee_src/n_exp.c:1.8.42.1
--- src/lib/libm/noieee_src/n_exp.c:1.8 Thu Mar 20 16:41:26 2008
+++ src/lib/libm/noieee_src/n_exp.c Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_exp.c,v 1.8 2008/03/20 16:41:26 mhitch Exp $ */
+/* $NetBSD: n_exp.c,v 1.8.42.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -82,6 +82,7 @@ static char sccsid[] = "@(#)exp.c 8.1 (B
#ifdef __weak_alias
__weak_alias(exp, _exp);
+__weak_alias(_expl, _exp);
__weak_alias(expf, _expf);
#endif
Index: src/lib/libm/noieee_src/n_log.c
diff -u src/lib/libm/noieee_src/n_log.c:1.7 src/lib/libm/noieee_src/n_log.c:1.7.42.1
--- src/lib/libm/noieee_src/n_log.c:1.7 Thu Mar 20 16:41:26 2008
+++ src/lib/libm/noieee_src/n_log.c Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_log.c,v 1.7 2008/03/20 16:41:26 mhitch Exp $ */
+/* $NetBSD: n_log.c,v 1.7.42.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -43,6 +43,7 @@ static char sccsid[] = "@(#)log.c 8.2 (B
#ifdef __weak_alias
__weak_alias(log, _log);
+__weak_alias(_logl, _log);
__weak_alias(logf, _logf);
#endif
Index: src/lib/libm/noieee_src/n_sinh.c
diff -u src/lib/libm/noieee_src/n_sinh.c:1.7 src/lib/libm/noieee_src/n_sinh.c:1.7.42.1
--- src/lib/libm/noieee_src/n_sinh.c:1.7 Thu Mar 20 16:41:26 2008
+++ src/lib/libm/noieee_src/n_sinh.c Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_sinh.c,v 1.7 2008/03/20 16:41:26 mhitch Exp $ */
+/* $NetBSD: n_sinh.c,v 1.7.42.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -80,6 +80,7 @@ static char sccsid[] = "@(#)sinh.c 8.1 (
#ifdef __weak_alias
__weak_alias(sinh, _sinh);
+__weak_alias(_sinhl, _sinh);
__weak_alias(sinhf, _sinhf);
#endif
Index: src/lib/libm/noieee_src/n_pow.c
diff -u src/lib/libm/noieee_src/n_pow.c:1.9 src/lib/libm/noieee_src/n_pow.c:1.9.4.1
--- src/lib/libm/noieee_src/n_pow.c:1.9 Sun Nov 24 14:46:18 2013
+++ src/lib/libm/noieee_src/n_pow.c Mon Oct 13 19:34:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: n_pow.c,v 1.9 2013/11/24 14:46:18 martin Exp $ */
+/* $NetBSD: n_pow.c,v 1.9.4.1 2014/10/13 19:34:58 martin Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -122,18 +122,19 @@ static const double zero=0.0, one=1.0, t
static double pow_P (double, double);
+#ifdef __weak_alias
+__weak_alias(_powf, powf);
+__weak_alias(_pow, pow);
+__weak_alias(_powl, pow);
+__weak_alias(powl, pow);
+#endif
+
float
powf(float x, float y)
{
return pow((double) x, (double) (y));
}
-long double
-powl(long double x, long double y)
-{
- return pow((double) x, (double) (y));
-}
-
double
pow(double x, double y)
{
Added files:
Index: src/lib/libm/complex/cabsl.c
diff -u /dev/null src/lib/libm/complex/cabsl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/cabsl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,16 @@
+/* $NetBSD: cabsl.c,v 1.1.2.2 2014/10/13 19:34:58 martin Exp $ */
+
+/*
+ * Public domain.
+ */
+
+#include "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+
+long double
+cabsl(long double complex z)
+{
+
+ return hypotl(__real__ z, __imag__ z);
+}
Index: src/lib/libm/complex/cacoshl.c
diff -u /dev/null src/lib/libm/complex/cacoshl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/cacoshl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,45 @@
+/* $NetBSD: cacoshl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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>
+
+long double complex
+cacoshl(long double complex z)
+{
+ long double complex w;
+
+#if 0 /* does not give the principal value */
+ w = I * cacosl(z);
+#else
+ w = clogl(z + csqrtl(z + 1) * csqrtl(z - 1));
+#endif
+ return w;
+}
Index: src/lib/libm/complex/cacosl.c
diff -u /dev/null src/lib/libm/complex/cacosl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/cacosl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,45 @@
+/* $NetBSD: cacosl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#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;
+}
Index: src/lib/libm/complex/cargl.c
diff -u /dev/null src/lib/libm/complex/cargl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/cargl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,16 @@
+/* $NetBSD: cargl.c,v 1.1.2.2 2014/10/13 19:34:58 martin Exp $ */
+
+/*
+ * Public domain.
+ */
+
+#include "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+
+long double
+cargl(long double complex z)
+{
+
+ return atan2l(__imag__ z, __real__ z);
+}
Index: src/lib/libm/complex/casinhl.c
diff -u /dev/null src/lib/libm/complex/casinhl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/casinhl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,42 @@
+/* $NetBSD: casinhl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+
+long double complex
+casinhl(long double complex z)
+{
+ long double complex w;
+
+ w = -1.0L * I * casinl(z * I);
+ return w;
+}
Index: src/lib/libm/complex/casinl.c
diff -u /dev/null src/lib/libm/complex/casinl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/casinl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,120 @@
+/* $NetBSD: casinl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+
+#ifdef __weak_alias
+__weak_alias(casinl, _casinl)
+#endif
+
+long double complex
+casinl(long double complex z)
+{
+ long double complex w;
+ long double complex ca, ct, zz, z2;
+ long double x, y;
+
+ x = creall(z);
+ y = cimagl(z);
+
+#if 0 /* MD: test is incorrect, casin(>1) is defined */
+ if (y == 0.0L) {
+ if (fabsl(x) > 1.0L) {
+ w = M_PI_2L + 0.0L * I;
+#if 0
+ mtherr ("casinl", DOMAIN);
+#endif
+ } else {
+ w = asinl(x) + 0.0L * I;
+ }
+ return w;
+ }
+#endif
+
+/* Power series expansion */
+/*
+b = cabsl(z);
+if( b < 0.125L )
+{
+z2.r = (x - y) * (x + y);
+z2.i = 2.0L * x * y;
+
+cn = 1.0L;
+n = 1.0L;
+ca.r = x;
+ca.i = y;
+sum.r = x;
+sum.i = y;
+do
+ {
+ ct.r = z2.r * ca.r - z2.i * ca.i;
+ ct.i = z2.r * ca.i + z2.i * ca.r;
+ ca.r = ct.r;
+ ca.i = ct.i;
+
+ cn *= n;
+ n += 1.0;
+ cn /= n;
+ n += 1.0;
+ b = cn/n;
+
+ ct.r *= b;
+ ct.i *= b;
+ sum.r += ct.r;
+ sum.i += ct.i;
+ b = fabsl(ct.r) + fabsl(ct.i);
+ }
+while( b > MACHEPL );
+w->r = sum.r;
+w->i = sum.i;
+return;
+}
+*/
+
+
+ ca = x + y * I;
+ ct = ca * I;
+ /* sqrtl( 1 - z*z) */
+ /* cmull( &ca, &ca, &zz ) */
+ /*x * x - y * y */
+ zz = (x - y) * (x + y) + (2.0L * x * y) * I;
+
+ zz = 1.0L - creall(zz) - cimagl(zz) * I;
+ z2 = csqrtl(zz);
+
+ zz = ct + z2;
+ zz = clogl(zz);
+ /* multiply by 1/i = -i */
+ w = zz * (-1.0L * I);
+ return w;
+}
Index: src/lib/libm/complex/catanl.c
diff -u /dev/null src/lib/libm/complex/catanl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/catanl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,80 @@
+/* $NetBSD: catanl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+#include <float.h>
+#include "cephes_subrl.h"
+
+#ifdef __weak_alias
+__weak_alias(catanl, _catanl)
+#endif
+
+#define MAXNUM LDBL_MAX
+
+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 = MAXNUM + MAXNUM * I;
+ return w;
+}
Index: src/lib/libm/complex/ccoshl.c
diff -u /dev/null src/lib/libm/complex/ccoshl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/ccoshl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,46 @@
+/* $NetBSD: ccoshl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+
+long double complex
+ccoshl(long double complex z)
+{
+ long double complex w;
+ long double x, y;
+
+ x = creall(z);
+ y = cimagl(z);
+ w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
+ return w;
+}
Index: src/lib/libm/complex/ccosl.c
diff -u /dev/null src/lib/libm/complex/ccosl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/ccosl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,46 @@
+/* $NetBSD: ccosl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+#include "cephes_subrl.h"
+
+long double complex
+ccosl(long double complex z)
+{
+ long double complex w;
+ long double ch, sh;
+
+ _cchshl(cimagl(z), &ch, &sh);
+ w = cosl(creall(z)) * ch - (sinl(creall(z)) * sh) * I;
+ return w;
+}
Index: src/lib/libm/complex/cephes_subrl.h
diff -u /dev/null src/lib/libm/complex/cephes_subrl.h:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/cephes_subrl.h Mon Oct 13 19:34:58 2014
@@ -0,0 +1,9 @@
+/* $NetBSD: cephes_subrl.h,v 1.1.2.2 2014/10/13 19:34:58 martin Exp $ */
+
+void _cchshl(long double, long double *, long double *);
+long double _redupil(long double);
+long double _ctansl(long double complex);
+
+#define M_PIL 3.14159265358979323846264338327950280e+00L
+#define M_PI_2L 1.57079632679489661923132169163975140e+00L
+
Index: src/lib/libm/complex/cexpl.c
diff -u /dev/null src/lib/libm/complex/cexpl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/cexpl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,47 @@
+/* $NetBSD: cexpl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#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;
+}
Index: src/lib/libm/complex/clogl.c
diff -u /dev/null src/lib/libm/complex/clogl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/clogl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,47 @@
+/* $NetBSD: clogl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+
+long double complex
+clogl(long double complex z)
+{
+ long double complex w;
+ long double p, rr;
+
+ rr = cabsl(z);
+ p = logl(rr);
+ rr = atan2l(cimagl(z), creall(z));
+ w = p + rr * I;
+ return w;
+}
Index: src/lib/libm/complex/cpowl.c
diff -u /dev/null src/lib/libm/complex/cpowl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/cpowl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,57 @@
+/* $NetBSD: cpowl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+
+long double complex
+cpowl(long double complex a, long double complex z)
+{
+ long double complex w;
+ long double x, y, r, theta, absa, arga;
+
+ x = creall(z);
+ y = cimagl(z);
+ absa = cabsl(a);
+ if (absa == 0.0L) {
+ return (0.0L + 0.0L * I);
+ }
+ arga = cargl(a);
+ r = powl(absa, x);
+ theta = x * arga;
+ if (y != 0.0L) {
+ r = r * expl(-y * arga);
+ theta = theta + y * logl(absa);
+ }
+ w = r * cosl(theta) + (r * sinl(theta)) * I;
+ return w;
+}
Index: src/lib/libm/complex/csinhl.c
diff -u /dev/null src/lib/libm/complex/csinhl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/csinhl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,46 @@
+/* $NetBSD: csinhl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+
+long double complex
+csinhl(long double complex z)
+{
+ long double complex w;
+ long double x, y;
+
+ x = creall(z);
+ y = cimagl(z);
+ w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I;
+ return w;
+}
Index: src/lib/libm/complex/csinl.c
diff -u /dev/null src/lib/libm/complex/csinl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/csinl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,46 @@
+/* $NetBSD: csinl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+#include "cephes_subrl.h"
+
+long double complex
+csinl(long double complex z)
+{
+ long double complex w;
+ long double ch, sh;
+
+ _cchshl(cimagl(z), &ch, &sh);
+ w = sinl(creall(z)) * ch + (cosl(creall(z)) * sh) * I;
+ return w;
+}
Index: src/lib/libm/complex/ctanhl.c
diff -u /dev/null src/lib/libm/complex/ctanhl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/ctanhl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,48 @@
+/* $NetBSD: ctanhl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+
+long double complex
+ctanhl(long double complex z)
+{
+ long double complex w;
+ long double x, y, d;
+
+ x = creall(z);
+ y = cimagl(z);
+ d = coshl(2.0L * x) + cosl(2.0L * y);
+ w = sinhl(2.0L * x) / d + (sinl(2.0L * y) / d) * I;
+
+ return w;
+}
Index: src/lib/libm/complex/ctanl.c
diff -u /dev/null src/lib/libm/complex/ctanl.c:1.1.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/ctanl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,59 @@
+/* $NetBSD: ctanl.c,v 1.1.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+#include <float.h>
+#include "cephes_subrl.h"
+
+#define MAXNUM LDBL_MAX
+
+long double complex
+ctanl(long double complex z)
+{
+ long double complex w;
+ long double d;
+
+ d = cosl(2.0L * creall(z)) + coshl(2.0L * cimagl(z));
+
+ if (fabsl(d) < 0.25L)
+ d = _ctansl(z);
+
+ if (d == 0.0L) {
+ /* mtherr ("ctan", OVERFLOW); */
+ w = MAXNUM + MAXNUM * I;
+ return w;
+ }
+
+ w = sinl(2.0L * creall(z)) / d + (sinhl(2.0L * cimagl(z)) / d) * I;
+ return w;
+}
Index: src/lib/libm/complex/catanhl.c
diff -u /dev/null src/lib/libm/complex/catanhl.c:1.3.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/catanhl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,42 @@
+/* $NetBSD: catanhl.c,v 1.3.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+
+long double complex
+catanhl(long double complex z)
+{
+ long double complex w;
+
+ w = -1.0L * I * catanl(z * I);
+ return w;
+}
Index: src/lib/libm/complex/cephes_subrl.c
diff -u /dev/null src/lib/libm/complex/cephes_subrl.c:1.2.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/cephes_subrl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,129 @@
+/* $NetBSD: cephes_subrl.c,v 1.2.2.2 2014/10/13 19:34:58 martin 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 "../src/namespace.h"
+#include <complex.h>
+#include <math.h>
+#include "cephes_subrl.h"
+
+/* calculate cosh and sinh */
+
+void
+_cchshl(long double x, long double *c, long double *s)
+{
+ long double e, ei;
+
+ if (fabsl(x) <= 0.5L) {
+ *c = coshl(x);
+ *s = sinhl(x);
+ } else {
+ e = expl(x);
+ ei = 0.5L / e;
+ e = 0.5L * e;
+ *s = e - ei;
+ *c = e + ei;
+ }
+}
+
+/* Program to subtract nearest integer multiple of PI */
+
+/* extended precision value of PI: */
+static const long double DP1 = 3.14159265358979323829596852490908531763125L;
+static const long double DP2 = 1.6667485837041756656403424829301998703007e-19L;
+#ifndef __vax__
+static const long double DP3 = 1.8830410776607851167459095484560349402753e-39L;
+#define MACHEPL 1.1e-38L
+#else
+static const long double DP3 = 0L;
+#define MACHEPL 1.1e-19L
+#endif
+
+long double
+_redupil(long double x)
+{
+ long double t;
+ long long i;
+
+ t = x / M_PIL;
+ if (t >= 0.0L)
+ t += 0.5L;
+ else
+ t -= 0.5L;
+
+ i = t; /* the multiple */
+ t = i;
+ t = ((x - t * DP1) - t * DP2) - t * DP3;
+ return t;
+}
+
+/* Taylor series expansion for cosh(2y) - cos(2x) */
+
+long double
+_ctansl(long double complex z)
+{
+ long double f, x, x2, y, y2, rn, t;
+ long double d;
+
+ x = fabsl(2.0L * creall(z));
+ y = fabsl(2.0L * cimagl(z));
+
+ x = _redupil(x);
+
+ x = x * x;
+ y = y * y;
+ x2 = 1.0;
+ y2 = 1.0;
+ f = 1.0;
+ rn = 0.0;
+ d = 0.0;
+ do {
+ rn += 1.0L;
+ f *= rn;
+ rn += 1.0L;
+ f *= rn;
+ x2 *= x;
+ y2 *= y;
+ t = y2 + x2;
+ t /= f;
+ d += t;
+
+ rn += 1.0L;
+ f *= rn;
+ rn += 1.0L;
+ f *= rn;
+ x2 *= x;
+ y2 *= y;
+ t = y2 - x2;
+ t /= f;
+ d += t;
+ } while (fabsl(t/d) > MACHEPL);
+ return d;
+}
Index: src/lib/libm/complex/csqrtl.c
diff -u /dev/null src/lib/libm/complex/csqrtl.c:1.2.2.2
--- /dev/null Mon Oct 13 19:34:59 2014
+++ src/lib/libm/complex/csqrtl.c Mon Oct 13 19:34:58 2014
@@ -0,0 +1,114 @@
+/*-
+ * Copyright (c) 2007-2008 David Schultz <[email protected]>
+ * 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 AUTHOR 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 AUTHOR 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 <sys/cdefs.h>
+#if 0
+__FBSDID("$FreeBSD: head/lib/msun/src/s_csqrtl.c 181402 2008-08-08 00:15:16Z das $");
+#else
+__RCSID("$NetBSD: csqrtl.c,v 1.2.2.2 2014/10/13 19:34:58 martin Exp $");
+#endif
+
+#include "../src/namespace.h"
+#include <complex.h>
+#include <float.h>
+#include <math.h>
+#include <stdbool.h>
+
+/*
+ * gcc doesn't implement complex multiplication or division correctly,
+ * so we need to handle infinities specially. We turn on this pragma to
+ * notify conforming c99 compilers that the fast-but-incorrect code that
+ * gcc generates is acceptable, since the special cases have already been
+ * handled.
+ */
+// #pragma STDC CX_LIMITED_RANGE ON
+
+/* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). */
+#define THRESH (LDBL_MAX / 2.414213562373095048801688724209698L)
+
+#define cpackl(r, i) ((r) + (i) * I)
+
+long double complex
+csqrtl(long double complex z)
+{
+ long double complex result;
+ long double a, b;
+ long double t;
+ bool scale;
+
+ a = creall(z);
+ b = cimagl(z);
+
+ /* Handle special cases. */
+ if (z == 0.0L)
+ return (cpackl(0.0L, b));
+ if (isinf(b))
+ return (cpackl(INFINITY, b));
+ if (isnan(a)) {
+ t = (b - b) / (b - b); /* raise invalid if b is not a NaN */
+ return (cpackl(a, t)); /* return NaN + NaN i */
+ }
+ if (isinf(a)) {
+ /*
+ * csqrt(inf + NaN i) = inf + NaN i
+ * csqrt(inf + y i) = inf + 0 i
+ * csqrt(-inf + NaN i) = NaN +- inf i
+ * csqrt(-inf + y i) = 0 + inf i
+ */
+ if (signbit(a))
+ return (cpackl(fabsl(b - b), copysignl(a, b)));
+ else
+ return (cpackl(a, copysignl(b - b, b)));
+ }
+ /*
+ * The remaining special case (b is NaN) is handled just fine by
+ * the normal code path below.
+ */
+
+ /* Scale to avoid overflow. */
+ if (fabsl(a) >= THRESH || fabsl(b) >= THRESH) {
+ a *= 0.25L;
+ b *= 0.25L;
+ scale = true;
+ } else {
+ scale = false;
+ }
+
+ /* Algorithm 312, CACM vol 10, Oct 1967. */
+ if (a >= 0L) {
+ t = sqrtl((a + hypotl(a, b)) * 0.5L);
+ result = cpackl(t, b / (2.0L * t));
+ } else {
+ t = sqrtl((-a + hypotl(a, b)) * 0.5L);
+ result = cpackl(fabsl(b) / (2.0L * t), copysignl(t, b));
+ }
+
+ /* Rescale. */
+ if (scale)
+ return (result * 2.0L);
+ else
+ return (result);
+}