public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Add missing long double functions to Cygwin
@ 2016-03-29 13:04 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2016-03-29 13:04 UTC (permalink / raw)
To: cygwin-cvs, newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=792e51b721491b19904e046124fb8c4c0e83f621
commit 792e51b721491b19904e046124fb8c4c0e83f621
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Mon Mar 28 19:35:20 2016 +0200
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
newlib/libc/include/complex.h | 27 +-
newlib/libc/include/math.h | 26 +-
newlib/libc/include/tgmath.h | 7 +-
winsup/cygwin/Makefile.in | 100 ++-
winsup/cygwin/common.din | 102 ++-
winsup/cygwin/i686.din | 27 +-
winsup/cygwin/include/cygwin/version.h | 13 +-
winsup/cygwin/math.h | 43 ++
winsup/cygwin/math/DISCLAIMER.PD | 9 +
winsup/cygwin/math/acosh.def.h | 70 ++
winsup/cygwin/math/acoshl.c | 46 ++
winsup/cygwin/math/acosl.c | 22 +
winsup/cygwin/math/asinhl.c | 33 +
winsup/cygwin/math/asinl.c | 27 +
winsup/cygwin/math/atan2l.c | 14 +
winsup/cygwin/math/atanhl.c | 34 +
winsup/cygwin/math/atanl.c | 17 +
winsup/cygwin/math/cabs.def.h | 49 ++
winsup/cygwin/math/cabsl.c | 48 ++
winsup/cygwin/math/cacos.def.h | 57 ++
winsup/cygwin/math/cacosh.def.h | 100 +++
winsup/cygwin/math/cacosl.c | 50 ++
winsup/cygwin/math/carg.def.h | 49 ++
winsup/cygwin/math/cargl.c | 48 ++
winsup/cygwin/math/casin.def.h | 61 ++
winsup/cygwin/math/casinh.def.h | 99 +++
winsup/cygwin/math/casinl.c | 50 ++
winsup/cygwin/math/catan.def.h | 61 ++
winsup/cygwin/math/catanh.def.h | 93 +++
winsup/cygwin/math/catanl.c | 50 ++
winsup/cygwin/math/cbrtl.c | 80 ++
winsup/cygwin/math/ccos.def.h | 54 ++
winsup/cygwin/math/ccosh.def.h | 95 +++
winsup/cygwin/math/ccosl.c | 50 ++
winsup/cygwin/math/ceil.S | 124 +++
winsup/cygwin/math/ceilf.S | 120 +++
winsup/cygwin/math/ceill.S | 64 ++
winsup/cygwin/math/cephes_emath.c | 1283 ++++++++++++++++++++++++++++++++
winsup/cygwin/math/cephes_emath.h | 719 ++++++++++++++++++
winsup/cygwin/math/cephes_mconf.h | 417 +++++++++++
winsup/cygwin/math/cexp.def.h | 111 +++
winsup/cygwin/math/cexpl.c | 48 ++
winsup/cygwin/math/cimag.def.h | 49 ++
winsup/cygwin/math/cimagl.c | 48 ++
winsup/cygwin/math/clog.def.h | 71 ++
winsup/cygwin/math/clog10.def.h | 71 ++
winsup/cygwin/math/clog10l.c | 48 ++
winsup/cygwin/math/clogl.c | 48 ++
winsup/cygwin/math/complex_internal.h | 153 ++++
winsup/cygwin/math/conj.def.h | 49 ++
winsup/cygwin/math/conjl.c | 48 ++
winsup/cygwin/math/copysignl.S | 56 ++
winsup/cygwin/math/cos.def.h | 65 ++
winsup/cygwin/math/coshl.c | 45 ++
winsup/cygwin/math/cosl.c | 46 ++
winsup/cygwin/math/cosl_internal.S | 55 ++
winsup/cygwin/math/cossin.c | 75 ++
winsup/cygwin/math/cpow.def.h | 49 ++
winsup/cygwin/math/cpowl.c | 48 ++
winsup/cygwin/math/cproj.def.h | 58 ++
winsup/cygwin/math/cprojl.c | 48 ++
winsup/cygwin/math/creal.def.h | 49 ++
winsup/cygwin/math/creall.c | 48 ++
winsup/cygwin/math/csin.def.h | 61 ++
winsup/cygwin/math/csinh.def.h | 107 +++
winsup/cygwin/math/csinl.c | 50 ++
winsup/cygwin/math/csqrt.def.h | 122 +++
winsup/cygwin/math/csqrtl.c | 48 ++
winsup/cygwin/math/ctan.def.h | 61 ++
winsup/cygwin/math/ctanh.def.h | 94 +++
winsup/cygwin/math/ctanl.c | 50 ++
winsup/cygwin/math/erfl.c | 303 ++++++++
winsup/cygwin/math/exp.def.h | 136 ++++
winsup/cygwin/math/exp10l.c | 8 +
winsup/cygwin/math/exp2.S | 94 +++
winsup/cygwin/math/exp2l.S | 92 +++
winsup/cygwin/math/expl.c | 46 ++
winsup/cygwin/math/expm1.def.h | 72 ++
winsup/cygwin/math/expm1l.c | 46 ++
winsup/cygwin/math/fabsl.c | 18 +
winsup/cygwin/math/fastmath.h | 120 +++
winsup/cygwin/math/fdiml.c | 24 +
winsup/cygwin/math/finite.c | 19 +
winsup/cygwin/math/floorl.S | 72 ++
winsup/cygwin/math/fmal.c | 12 +
winsup/cygwin/math/fmaxl.c | 13 +
winsup/cygwin/math/fminl.c | 12 +
winsup/cygwin/math/fmodl.c | 20 +
winsup/cygwin/math/frexpl.S | 130 ++++
winsup/cygwin/math/ilogbl.S | 65 ++
winsup/cygwin/math/internal_logl.S | 66 ++
winsup/cygwin/math/isinf.c | 18 +
winsup/cygwin/math/isnan.c | 18 +
winsup/cygwin/math/ldexpl.c | 23 +
winsup/cygwin/math/lgammal.c | 342 +++++++++
winsup/cygwin/math/llrint.c | 18 +
winsup/cygwin/math/llrintf.c | 17 +
winsup/cygwin/math/llrintl.c | 18 +
winsup/cygwin/math/llroundl.c | 38 +
winsup/cygwin/math/log.def.h | 69 ++
winsup/cygwin/math/log10l.S | 93 +++
winsup/cygwin/math/log1pl.S | 102 +++
winsup/cygwin/math/log2l.S | 87 +++
winsup/cygwin/math/logbl.c | 22 +
winsup/cygwin/math/logl.c | 46 ++
winsup/cygwin/math/lrint.c | 30 +
winsup/cygwin/math/lrintf.c | 30 +
winsup/cygwin/math/lrintl.c | 18 +
winsup/cygwin/math/lroundl.c | 37 +
winsup/cygwin/math/modfl.c | 41 +
winsup/cygwin/math/nearbyint.S | 57 ++
winsup/cygwin/math/nearbyintf.S | 57 ++
winsup/cygwin/math/nearbyintl.S | 58 ++
winsup/cygwin/math/nextafterl.c | 71 ++
winsup/cygwin/math/nexttoward.c | 47 ++
winsup/cygwin/math/nexttowardf.c | 43 ++
winsup/cygwin/math/pow.def.h | 215 ++++++
winsup/cygwin/math/pow10l.c | 8 +
winsup/cygwin/math/powi.def.h | 153 ++++
winsup/cygwin/math/powil.c | 46 ++
winsup/cygwin/math/powl.c | 46 ++
winsup/cygwin/math/remainder.S | 40 +
winsup/cygwin/math/remainderf.S | 40 +
winsup/cygwin/math/remainderl.S | 39 +
winsup/cygwin/math/remquol.S | 75 ++
winsup/cygwin/math/rint.c | 29 +
winsup/cygwin/math/rintf.c | 29 +
winsup/cygwin/math/rintl.c | 16 +
winsup/cygwin/math/roundl.c | 26 +
winsup/cygwin/math/scalbl.S | 35 +
winsup/cygwin/math/scalbnl.S | 41 +
winsup/cygwin/math/sin.def.h | 65 ++
winsup/cygwin/math/sinhl.c | 100 +++
winsup/cygwin/math/sinl.c | 46 ++
winsup/cygwin/math/sinl_internal.S | 58 ++
winsup/cygwin/math/sqrt.def.h | 94 +++
winsup/cygwin/math/sqrtl.c | 46 ++
winsup/cygwin/math/tanhl.c | 92 +++
winsup/cygwin/math/tanl.S | 62 ++
winsup/cygwin/math/tgammal.c | 393 ++++++++++
winsup/cygwin/math/truncl.c | 26 +
winsup/cygwin/x86_64.din | 6 -
142 files changed, 10969 insertions(+), 42 deletions(-)
diff --git a/newlib/libc/include/complex.h b/newlib/libc/include/complex.h
index 3150f34..89d6162 100644
--- a/newlib/libc/include/complex.h
+++ b/newlib/libc/include/complex.h
@@ -108,12 +108,10 @@ long double cimagl(long double complex);
/* 7.3.9.3 The conj functions */
double complex conj(double complex);
float complex conjf(float complex);
-/*long double complex conjl(long double complex); */
/* 7.3.9.4 The cproj functions */
double complex cproj(double complex);
float complex cprojf(float complex);
-/*long double complex cprojl(long double complex); */
/* 7.3.9.5 The creal functions */
double creal(double complex);
@@ -125,6 +123,31 @@ double complex clog10(double complex);
float complex clog10f(float complex);
#endif
+#if defined(__CYGWIN__)
+long double complex cacosl(long double complex);
+long double complex casinl(long double complex);
+long double complex catanl(long double complex);
+long double complex ccosl(long double complex);
+long double complex csinl(long double complex);
+long double complex ctanl(long double complex);
+long double complex cacoshl(long double complex);
+long double complex casinhl(long double complex);
+long double complex catanhl(long double complex);
+long double complex ccoshl(long double complex);
+long double complex csinhl(long double complex);
+long double complex ctanhl(long double complex);
+long double complex cexpl(long double complex);
+long double complex clogl(long double complex);
+long double complex cpowl(long double complex, long double complex);
+long double complex csqrtl(long double complex);
+long double cargl(long double complex);
+long double complex conjl(long double complex);
+long double complex cprojl(long double complex);
+#if __GNU_VISIBLE
+long double complex clog10l(long double complex);
+#endif
+#endif /* __CYGWIN__ */
+
__END_DECLS
#endif /* ! _COMPLEX_H */
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index eeedeba..e5d6123 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -421,8 +421,12 @@ extern float log2f _PARAMS((float));
extern float hypotf _PARAMS((float, float));
#endif /* ! defined (_REENT_ONLY) */
-/* On platforms where long double equals double. */
-#ifdef _LDBL_EQ_DBL
+/* Newlib doesn't fully support long double math functions so far.
+ On platforms where long double equals double the long double functions
+ simply call the double functions. On Cygwin the long double functions
+ are implemented independently from newlib to be able to use optimized
+ assembler functions despite using the Microsoft x86_64 ABI. */
+#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
/* Reentrant ANSI C functions. */
#ifndef __math_68881
extern long double atanl _PARAMS((long double));
@@ -492,7 +496,7 @@ extern long double lgammal _PARAMS((long double));
extern long double erfl _PARAMS((long double));
extern long double erfcl _PARAMS((long double));
#endif /* ! defined (_REENT_ONLY) */
-#else /* !_LDBL_EQ_DBL */
+#else /* !_LDBL_EQ_DBL && !__CYGWIN__ */
extern long double hypotl _PARAMS((long double, long double));
extern long double sqrtl _PARAMS((long double));
#ifdef __i386__
@@ -501,13 +505,16 @@ extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE));
extern long int lrintl _PARAMS((_LONG_DOUBLE));
extern long long int llrintl _PARAMS((_LONG_DOUBLE));
#endif /* __i386__ */
-#endif /* !_LDBL_EQ_DBL */
+#endif /* !_LDBL_EQ_DBL && !__CYGWIN__ */
#endif /* __ISO_C_VISIBLE >= 1999 */
#if __MISC_VISIBLE
extern double drem _PARAMS((double, double));
extern float dremf _PARAMS((float, float));
+#ifdef __CYGWIN__
+extern float dreml _PARAMS((long double, long double));
+#endif /* __CYGWIN__ */
extern double gamma_r _PARAMS((double, int *));
extern double lgamma_r _PARAMS((double, int *));
extern float gammaf_r _PARAMS((float, int *));
@@ -536,6 +543,9 @@ extern float jnf _PARAMS((int, float));
#if __GNU_VISIBLE
extern void sincos _PARAMS((double, double *, double *));
extern void sincosf _PARAMS((float, float *, float *));
+#ifdef __CYGWIN__
+extern void sincosl _PARAMS((long double, long double *, long double *));
+#endif /* __CYGWIN__ */
# ifndef exp10
extern double exp10 _PARAMS((double));
# endif
@@ -548,6 +558,14 @@ extern float exp10f _PARAMS((float));
# ifndef pow10f
extern float pow10f _PARAMS((float));
# endif
+#ifdef __CYGWIN__
+# ifndef exp10l
+extern float exp10l _PARAMS((float));
+# endif
+# ifndef pow10l
+extern float pow10l _PARAMS((float));
+# endif
+#endif /* __CYGWIN__ */
#endif /* __GNU_VISIBLE */
#if __MISC_VISIBLE || __XSI_VISIBLE
diff --git a/newlib/libc/include/tgmath.h b/newlib/libc/include/tgmath.h
index f9c8311..97dc50e 100644
--- a/newlib/libc/include/tgmath.h
+++ b/newlib/libc/include/tgmath.h
@@ -79,7 +79,7 @@
__tg_type3(__e1, __e2, __e3, long double _Complex) || \
__tg_type3(__e1, __e2, __e3, __typeof__(_Complex_I)))
-#ifdef _LDBL_EQ_DBL
+#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
#define __tg_impl_simple(x, y, z, fn, fnf, fnl, ...) \
__builtin_choose_expr(__tg_type_corr(x, y, z, long double), \
fnl(__VA_ARGS__), __builtin_choose_expr( \
@@ -161,9 +161,10 @@
#define lround(__x) __tg_simple(__x, lround)
#define nearbyint(__x) __tg_simple(__x, nearbyint)
#define nextafter(__x, __y) __tg_simple2(__x, __y, nextafter)
-/* not yet implemented even for _LDBL_EQ_DBL platforms
+/* not yet implemented even for _LDBL_EQ_DBL platforms */
+#ifdef __CYGWIN__
#define nexttoward(__x, __y) __tg_simplev(__x, nexttoward, __x, __y)
-*/
+#endif
#define remainder(__x, __y) __tg_simple2(__x, __y, remainder)
#define remquo(__x, __y, __z) __tg_impl_simple(__x, __x, __y, remquo, remquof, \
remquol, __x, __y, __z)
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 6695488..bcfaa2f 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -29,7 +29,7 @@ export CCWRAP_HEADERS:=. ${srcdir}
export CCWRAP_SYSTEM_HEADERS:=@cygwin_headers@ @newlib_headers@
export CCWRAP_DIRAFTER_HEADERS:=@windows_headers@
-VPATH+=$(srcdir)/regex $(srcdir)/lib $(srcdir)/libc
+VPATH+=$(srcdir)/regex $(srcdir)/lib $(srcdir)/libc $(srcdir)/math
target_cpu:=@target_cpu@
target_alias:=@target_alias@
@@ -153,6 +153,101 @@ DLL_IMPORTS:=${shell $(CC) -print-file-name=w32api/libkernel32.a} ${shell $(CC)
MT_SAFE_OBJECTS:=
#
+MATH_OFILES:= \
+ acoshl.o \
+ acosl.o \
+ asinhl.o \
+ asinl.o \
+ atan2l.o \
+ atanhl.o \
+ atanl.o \
+ cabsl.o \
+ cacosl.o \
+ cargl.o \
+ casinl.o \
+ catanl.o \
+ cbrtl.o \
+ ccosl.o \
+ ceill.o \
+ cephes_emath.o \
+ cexpl.o \
+ cimagl.o \
+ clog10l.o \
+ clogl.o \
+ conjl.o \
+ copysignl.o \
+ coshl.o \
+ cosl.o \
+ cosl_internal.o \
+ cossin.o \
+ cpowl.o \
+ cprojl.o \
+ creall.o \
+ csinl.o \
+ csqrtl.o \
+ ctanl.o \
+ erfl.o \
+ exp10l.o \
+ exp2l.o \
+ expl.o \
+ expm1l.o \
+ fabsl.o \
+ fdiml.o \
+ finite.o \
+ floorl.o \
+ fmal.o \
+ fmaxl.o \
+ fminl.o \
+ fmodl.o \
+ frexpl.o \
+ ilogbl.o \
+ internal_logl.o \
+ isinf.o \
+ isnan.o \
+ ldexpl.o \
+ lgammal.o \
+ llrint.o \
+ llrintf.o \
+ llrintl.o \
+ llroundl.o \
+ log10l.o \
+ log1pl.o \
+ log2l.o \
+ logbl.o \
+ logl.o \
+ lrint.o \
+ lrintf.o \
+ lrintl.o \
+ lroundl.o \
+ modfl.o \
+ nearbyint.o \
+ nearbyintf.o \
+ nearbyintl.o \
+ nextafterl.o \
+ nexttoward.o \
+ nexttowardf.o \
+ pow10l.o \
+ powil.o \
+ powl.o \
+ remainder.o \
+ remainderf.o \
+ remainderl.o \
+ remquol.o \
+ rint.o \
+ rintf.o \
+ rintl.o \
+ roundl.o \
+ scalbl.o \
+ scalbnl.o \
+ sinhl.o \
+ sinl.o \
+ sinl_internal.o \
+ sqrtl.o \
+ tanhl.o \
+ tanl.o \
+ tgammal.o \
+ truncl.o
+
DLL_OFILES:= \
advapi32.o \
arc4random_stir.o \
@@ -305,6 +400,7 @@ DLL_OFILES:= \
xsique.o \
$(EXTRA_OFILES) \
$(MALLOC_OFILES) \
+ $(MATH_OFILES) \
$(MT_SAFE_OBJECTS)
EXCLUDE_STATIC_OFILES:=$(addprefix --exclude=,\
@@ -626,7 +722,7 @@ $(srcdir)/devices.cc: gendevices devices.in devices.h
${CURDIR}/libc.a: ${LIB_NAME} ${CURDIR}/libm.a libpthread.a libutil.a
${speclib} -v ${@F}
-${CURDIR}/libm.a: ${LIB_NAME} $(LIBM)
+${CURDIR}/libm.a: ${LIB_NAME} $(LIBM) $(MATH_OFILES)
${speclib} ${@F}
libpthread.a: ${LIB_NAME} pthread.o thread.o
diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 7e72abe..c2f5f0f 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -64,10 +64,10 @@ __getpagesize = getpagesize SIGFE
__getreent NOSIGFE
__gnu_basename NOSIGFE
__infinity NOSIGFE
-__isinfd NOSIGFE
-__isinff NOSIGFE
-__isnand NOSIGFE
-__isnanf NOSIGFE
+__isinfd = isinf NOSIGFE
+__isinff = isinff NOSIGFE
+__isnand = isnan NOSIGFE
+__isnanf = isnanf NOSIGFE
__locale_mb_cur_max NOSIGFE
__main NOSIGFE
__mempcpy = mempcpy NOSIGFE
@@ -169,6 +169,8 @@ acos NOSIGFE
acosf NOSIGFE
acosh NOSIGFE
acoshf NOSIGFE
+acoshl NOSIGFE
+acosl NOSIGFE
alarm SIGFE
aligned_alloc SIGFE
alphasort NOSIGFE
@@ -195,14 +197,19 @@ asin NOSIGFE
asinf NOSIGFE
asinh NOSIGFE
asinhf NOSIGFE
+asinhl NOSIGFE
+asinl NOSIGFE
asnprintf SIGFE
asprintf SIGFE
atan NOSIGFE
atan2 NOSIGFE
atan2f NOSIGFE
+atan2l NOSIGFE
atanf NOSIGFE
atanh NOSIGFE
atanhf NOSIGFE
+atanhl NOSIGFE
+atanl NOSIGFE
atexit = cygwin_atexit SIGFE
atof SIGFE
atoff SIGFE
@@ -226,28 +233,40 @@ cacos NOSIGFE
cacosf NOSIGFE
cacosh NOSIGFE
cacoshf NOSIGFE
+cacoshl NOSIGFE
+cacosl NOSIGFE
calloc SIGFE
canonicalize_file_name SIGFE
carg NOSIGFE
cargf NOSIGFE
+cargl NOSIGFE
casin NOSIGFE
casinf NOSIGFE
casinh NOSIGFE
casinhf NOSIGFE
+casinhl NOSIGFE
+casinl NOSIGFE
catan NOSIGFE
catanf NOSIGFE
catanh NOSIGFE
catanhf NOSIGFE
+catanhl NOSIGFE
+catanl NOSIGFE
cbrt NOSIGFE
cbrtf NOSIGFE
+cbrtl NOSIGFE
ccos NOSIGFE
ccosf NOSIGFE
ccosh NOSIGFE
ccoshf NOSIGFE
+ccoshl NOSIGFE
+ccosl NOSIGFE
ceil NOSIGFE
ceilf NOSIGFE
+ceill NOSIGFE
cexp NOSIGFE
cexpf NOSIGFE
+cexpl NOSIGFE
cfgetispeed NOSIGFE
cfgetospeed NOSIGFE
cfmakeraw NOSIGFE
@@ -274,24 +293,32 @@ clock_settime SIGFE
clog NOSIGFE
clog10 NOSIGFE
clog10f NOSIGFE
+clog10l NOSIGFE
clogf NOSIGFE
+clogl NOSIGFE
close SIGFE
closedir SIGFE
closelog SIGFE
confstr NOSIGFE
conj NOSIGFE
conjf NOSIGFE
+conjl NOSIGFE
connect = cygwin_connect SIGFE
copysign NOSIGFE
copysignf NOSIGFE
+copysignl NOSIGFE
cos NOSIGFE
cosf NOSIGFE
cosh NOSIGFE
coshf NOSIGFE
+coshl NOSIGFE
+cosl NOSIGFE
cpow NOSIGFE
cpowf NOSIGFE
+cpowl NOSIGFE
cproj NOSIGFE
cprojf NOSIGFE
+cprojl NOSIGFE
creal NOSIGFE
crealf NOSIGFE
creall NOSIGFE
@@ -300,12 +327,17 @@ csin NOSIGFE
csinf NOSIGFE
csinh NOSIGFE
csinhf NOSIGFE
+csinhl NOSIGFE
+csinl NOSIGFE
csqrt NOSIGFE
csqrtf NOSIGFE
+csqrtl NOSIGFE
ctan NOSIGFE
ctanf NOSIGFE
ctanh NOSIGFE
ctanhf NOSIGFE
+ctanhl NOSIGFE
+ctanl NOSIGFE
ctermid SIGFE
ctime SIGFE
ctime_r SIGFE
@@ -342,8 +374,9 @@ dn_expand = __dn_expand SIGFE
dn_skipname = __dn_skipname SIGFE
dprintf SIGFE
drand48 NOSIGFE
-drem NOSIGFE
-dremf NOSIGFE
+drem = remainder NOSIGFE
+dremf= remainderf NOSIGFE
+dreml= remainderl NOSIGFE
dup SIGFE
dup2 SIGFE
dup3 SIGFE
@@ -370,7 +403,9 @@ erand48 NOSIGFE
erf NOSIGFE
erfc NOSIGFE
erfcf NOSIGFE
+erfcl NOSIGFE
erff NOSIGFE
+erfl NOSIGFE
err SIGFE
error SIGFE
error_at_line SIGFE
@@ -387,13 +422,18 @@ exit = cygwin_exit SIGFE
exp NOSIGFE
exp10 NOSIGFE
exp10f NOSIGFE
+exp10l NOSIGFE
exp2 NOSIGFE
exp2f NOSIGFE
+exp2l NOSIGFE
expf NOSIGFE
+expl NOSIGFE
expm1 NOSIGFE
expm1f NOSIGFE
+expm1l NOSIGFE
fabs NOSIGFE
fabsf NOSIGFE
+fabsl NOSIGFE
faccessat SIGFE
facl SIGFE
fchdir SIGFE
@@ -410,6 +450,7 @@ fcvtf SIGFE
fdatasync SIGFE
fdim NOSIGFE
fdimf NOSIGFE
+fdiml NOSIGFE
fdopen SIGFE
fdopendir SIGFE
feclearexcept NOSIGFE
@@ -459,15 +500,20 @@ flock SIGFE
flockfile SIGFE
floor NOSIGFE
floorf NOSIGFE
+floorl NOSIGFE
fma NOSIGFE
fmaf NOSIGFE
+fmal NOSIGFE
fmax NOSIGFE
fmaxf NOSIGFE
+fmaxl NOSIGFE
fmemopen SIGFE
fmin NOSIGFE
fminf NOSIGFE
+fminl NOSIGFE
fmod NOSIGFE
fmodf NOSIGFE
+fmodl NOSIGFE
fnmatch NOSIGFE
fopen SIGFE
fopencookie SIGFE
@@ -493,6 +539,7 @@ fremovexattr SIGFE
freopen SIGFE
frexp NOSIGFE
frexpf NOSIGFE
+frexpl NOSIGFE
fscanf SIGFE
fseek SIGFE
fseeko SIGFE
@@ -650,6 +697,7 @@ if_nameindex SIGFE
if_nametoindex SIGFE
ilogb NOSIGFE
ilogbf NOSIGFE
+ilogbl NOSIGFE
imaxabs = llabs NOSIGFE
imaxdiv = lldiv NOSIGFE
index NOSIGFE
@@ -680,9 +728,11 @@ isdigit NOSIGFE
isgraph NOSIGFE
isinf NOSIGFE
isinff NOSIGFE
+isinfl NOSIGFE
islower NOSIGFE
isnan NOSIGFE
isnanf NOSIGFE
+isnanl NOSIGFE
isprint NOSIGFE
ispunct NOSIGFE
issetugid NOSIGFE
@@ -717,12 +767,15 @@ lchown SIGFE
lcong48 NOSIGFE
ldexp NOSIGFE
ldexpf NOSIGFE
+ldexpl NOSIGFE
ldiv NOSIGFE
lfind NOSIGFE
lgamma NOSIGFE
lgamma_r NOSIGFE
lgammaf NOSIGFE
lgammaf_r NOSIGFE
+lgammal NOSIGFE
+lgammal_r NOSIGFE
lgetxattr SIGFE
link SIGFE
linkat SIGFE
@@ -731,8 +784,12 @@ listxattr SIGFE
llabs NOSIGFE
lldiv NOSIGFE
llistxattr SIGFE
+llrint NOSIGFE
+llrintf NOSIGFE
+llrintl NOSIGFE
llround NOSIGFE
llroundf NOSIGFE
+llroundl NOSIGFE
localeconv NOSIGFE
localtime SIGFE
localtime_r SIGFE
@@ -740,13 +797,18 @@ lockf SIGFE
log NOSIGFE
log10 NOSIGFE
log10f NOSIGFE
+log10l NOSIGFE
log1p NOSIGFE
log1pf NOSIGFE
+log1pl NOSIGFE
log2 NOSIGFE
log2f NOSIGFE
+log2l NOSIGFE
logb NOSIGFE
logbf NOSIGFE
+logbl NOSIGFE
logf NOSIGFE
+logl NOSIGFE
login SIGFE
login_tty SIGFE
logout SIGFE
@@ -754,8 +816,12 @@ logwtmp SIGFE
longjmp NOSIGFE
lrand48 NOSIGFE
lremovexattr SIGFE
+lrint NOSIGFE
+lrintf NOSIGFE
+lrintl NOSIGFE
lround NOSIGFE
lroundf NOSIGFE
+lroundl NOSIGFE
lsearch NOSIGFE
lseek SIGFE
lsetxattr SIGFE
@@ -805,6 +871,7 @@ mlock SIGFE
mmap SIGFE
modf NOSIGFE
modff NOSIGFE
+modfl NOSIGFE
mount SIGFE
mprotect SIGFE
mq_close SIGFE
@@ -830,8 +897,13 @@ nanf NOSIGFE
nanosleep SIGFE
nearbyint NOSIGFE
nearbyintf NOSIGFE
+nearbyintl NOSIGFE
nextafter NOSIGFE
nextafterf NOSIGFE
+nextafterl NOSIGFE
+nexttoward NOSIGFE
+nexttowardf NOSIGFE
+nexttowardl NOSIGFE
nftw SIGFE
nice SIGFE
nl_langinfo SIGFE
@@ -883,7 +955,9 @@ posix_spawn_file_actions_addopen SIGFE
pow NOSIGFE
pow10 NOSIGFE
pow10f NOSIGFE
+pow10l NOSIGFE
powf NOSIGFE
+powl NOSIGFE
ppoll SIGFE
pread SIGFE
printf SIGFE
@@ -1037,11 +1111,13 @@ regexec SIGFE
regfree SIGFE
remainder NOSIGFE
remainderf NOSIGFE
+remainderl NOSIGFE
remove SIGFE
removexattr SIGFE
remque NOSIGFE
remquo NOSIGFE
remquof NOSIGFE
+remquol NOSIGFE
rename SIGFE
renameat SIGFE
res_close = __res_close SIGFE
@@ -1063,9 +1139,13 @@ rewind SIGFE
rewinddir SIGFE
rexec = cygwin_rexec SIGFE
rindex NOSIGFE
+rint NOSIGFE
+rintf NOSIGFE
+rintl NOSIGFE
rmdir SIGFE
round NOSIGFE
roundf NOSIGFE
+roundl NOSIGFE
rpmatch SIGFE
rresvport = cygwin_rresvport SIGFE
rresvport_af = cygwin_rresvport_af SIGFE
@@ -1073,10 +1153,13 @@ ruserok SIGFE
sbrk SIGFE
scalb NOSIGFE
scalbf NOSIGFE
+scalbl NOSIGFE
scalbln NOSIGFE
scalblnf NOSIGFE
+scalblnl NOSIGFE
scalbn NOSIGFE
scalbnf NOSIGFE
+scalbnl NOSIGFE
scandir SIGFE
scandirat SIGFE
scanf SIGFE
@@ -1180,9 +1263,12 @@ sigwaitinfo SIGFE
sin NOSIGFE
sincos NOSIGFE
sincosf NOSIGFE
+sincosl NOSIGFE
sinf NOSIGFE
sinh NOSIGFE
sinhf NOSIGFE
+sinhl NOSIGFE
+sinl NOSIGFE
siprintf SIGFE
sleep SIGFE
snprintf SIGFE
@@ -1271,6 +1357,8 @@ tan NOSIGFE
tanf NOSIGFE
tanh NOSIGFE
tanhf NOSIGFE
+tanhl NOSIGFE
+tanl NOSIGFE
tcdrain SIGFE
tcflow SIGFE
tcflush SIGFE
@@ -1287,6 +1375,7 @@ tempnam SIGFE
tfind NOSIGFE
tgamma NOSIGFE
tgammaf NOSIGFE
+tgammal NOSIGFE
time SIGFE
timegm NOSIGFE
timelocal SIGFE
@@ -1307,6 +1396,7 @@ towupper NOSIGFE
trunc NOSIGFE
truncate SIGFE
truncf NOSIGFE
+truncl NOSIGFE
tsearch SIGFE
ttyname SIGFE
ttyname_r SIGFE
diff --git a/winsup/cygwin/i686.din b/winsup/cygwin/i686.din
index a9b3117..f3cd2fd 100644
--- a/winsup/cygwin/i686.din
+++ b/winsup/cygwin/i686.din
@@ -164,21 +164,21 @@ _f_frexp NOSIGFE
_f_frexpf NOSIGFE
_f_ldexp NOSIGFE
_f_ldexpf NOSIGFE
-_f_llrint NOSIGFE
-_f_llrintf NOSIGFE
-_f_llrintl NOSIGFE
+_f_llrint = llrint NOSIGFE
+_f_llrintf = llrintf NOSIGFE
+_f_llrintl = llrintl NOSIGFE
_f_log NOSIGFE
_f_log10 NOSIGFE
_f_log10f NOSIGFE
_f_logf NOSIGFE
-_f_lrint NOSIGFE
-_f_lrintf NOSIGFE
-_f_lrintl NOSIGFE
+_f_lrint = lrint NOSIGFE
+_f_lrintf = lrintf NOSIGFE
+_f_lrintl = lrintl NOSIGFE
_f_pow NOSIGFE
_f_powf NOSIGFE
-_f_rint NOSIGFE
-_f_rintf NOSIGFE
-_f_rintl NOSIGFE
+_f_rint = rint NOSIGFE
+_f_rintf = rintf NOSIGFE
+_f_rintl = rintl NOSIGFE
_f_tan NOSIGFE
_f_tanf NOSIGFE
_fabs = fabs NOSIGFE
@@ -622,19 +622,10 @@ fscanf_r = _fscanf_r SIGFE
get_osfhandle = _get_osfhandle SIGFE
getpwduid NOSIGFE
lacl SIGFE
-llrint = _f_llrint NOSIGFE
-llrintf = _f_llrintf NOSIGFE
-llrintl = _f_llrintl NOSIGFE
-lrint = _f_lrint NOSIGFE
-lrintf = _f_lrintf NOSIGFE
-lrintl = _f_lrintl NOSIGFE
posix_regcomp = regcomp SIGFE
posix_regerror = regerror SIGFE
posix_regexec = regexec SIGFE
posix_regfree = regfree SIGFE
-rint = _f_rint NOSIGFE
-rintf = _f_rintf NOSIGFE
-rintl = _f_rintl NOSIGFE
scanf_r = _scanf_r SIGFE
setmode = cygwin_setmode SIGFE
setregid32 SIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
index ee7c4ff..8b1a8fc 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -478,13 +478,24 @@ details. */
294: Export clog10, clog10f.
295: Export POSIX ACL functions.
296: Export __getpagesize.
+ 297: Export missing math functions, acoshl, acosl, asinhl, asinl, atan2l,
+ atanhl, atanl, cacoshl, cacosl, cargl, casinhl, casinl, catanhl,
+ catanl, ccoshl, ccosl, ceill, cexpl, clog10l, clogl, conjl,
+ copysignl, coshl, cosl, cpowl, cprojl, csinhl, csinl, csqrtl, ctanhl,
+ ctanl, dreml, erfcl, erfl, exp10l, exp2l, expl, expm1l, fabsl, fdiml,
+ floorl, fmal, fmaxl, fminl, fmodl, frexpl, ilogbl, isinfl, isnanl,
+ ldexpl, lgammal, lgammal_r, llroundl, log10l, log1pl, log2l, logbl,
+ logl, lroundl, modfl, nearbyintl, nextafterl, nexttoward,
+ nexttowardf, nexttowardl, pow10l, powl, remainderl, remquol, roundl,
+ scalbl, scalblnl, scalbnl, sincosl, sinhl, sinl, tanhl, tanl,
+ tgammal, truncl.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull,
sigaltstack, sethostname. */
#define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 296
+#define CYGWIN_VERSION_API_MINOR 297
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible
diff --git a/winsup/cygwin/math.h b/winsup/cygwin/math.h
new file mode 100644
index 0000000..d30ecf9
--- /dev/null
+++ b/winsup/cygwin/math.h
@@ -0,0 +1,43 @@
+#ifndef _LOCAL_MATH_H_
+#define _LOCAL_MATH_H_
+
+/* This header is required to define the types used by some of the
+ mingw-w64 based files in the math subdir. */
+
+typedef union __mingw_dbl_type_t {
+ double x;
+ unsigned long long val;
+ struct {
+ unsigned int low, high;
+ } lh;
+} __mingw_dbl_type_t;
+
+typedef union __mingw_flt_type_t {
+ float x;
+ unsigned int val;
+} __mingw_flt_type_t;
+
+typedef union __mingw_ldbl_type_t
+{
+ long double x;
+ struct {
+ unsigned int low, high;
+ int sign_exponent : 16;
+ int res1 : 16;
+ int res0 : 32;
+ } lh;
+} __mingw_ldbl_type_t;
+
+typedef union __mingw_fp_types_t
+{
+ long double *ld;
+ double *d;
+ float *f;
+ __mingw_ldbl_type_t *ldt;
+ __mingw_dbl_type_t *dt;
+ __mingw_flt_type_t *ft;
+} __mingw_fp_types_t;
+
+#include_next <math.h>
+
+#endif /* _LOCAL_MATH_H_ */
diff --git a/winsup/cygwin/math/DISCLAIMER.PD b/winsup/cygwin/math/DISCLAIMER.PD
new file mode 100644
index 0000000..6c2a7c3
--- /dev/null
+++ b/winsup/cygwin/math/DISCLAIMER.PD
@@ -0,0 +1,9 @@
+/**
+ * DISCLAIMER
+ * This file has no copyright assigned and is placed in the Public Domain.
+ *
+ * Its code is distributed in the hope that it will be useful but WITHOUT
+ * ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR IMPLIED ARE HEREBY DISCLAIMED.
+ * This includes but is not limited to warranties of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ */
diff --git a/winsup/cygwin/math/acosh.def.h b/winsup/cygwin/math/acosh.def.h
new file mode 100644
index 0000000..c039bd8
--- /dev/null
+++ b/winsup/cygwin/math/acosh.def.h
@@ -0,0 +1,70 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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_internal.h"
+#include <errno.h>
+#include "fastmath.h"
+
+__FLT_TYPE
+__FLT_ABI(acosh) (__FLT_TYPE x)
+{
+ int x_class = fpclassify (x);
+ if (x_class == FP_NAN || x < __FLT_CST(1.0))
+ {
+ __FLT_RPT_DOMAIN ("acosh", x, 0.0, __FLT_NAN);
+ return __FLT_NAN;
+ }
+ else if (x_class == FP_INFINITE)
+ {
+ __FLT_RPT_DOMAIN ("acosh", x, 0.0, __FLT_NAN);
+ return __FLT_NAN;
+ }
+
+ if (x > __FLT_CST(0x1p32))
+ return __FLT_ABI (__fast_log) (x) + 6.9314718055994530941723E-1L;
+
+ return __FLT_ABI (__fast_log) (x +
+ __FLT_ABI (__fast_sqrt) ((x + __FLT_CST(1.0)) * (x - __FLT_CST(1.0))));
+}
+
diff --git a/winsup/cygwin/math/acoshl.c b/winsup/cygwin/math/acoshl.c
new file mode 100644
index 0000000..88f9f13
--- /dev/null
+++ b/winsup/cygwin/math/acoshl.c
@@ -0,0 +1,46 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+#define _NEW_COMPLEX_LDOUBLE 1
+#include "acosh.def.h"
diff --git a/winsup/cygwin/math/acosl.c b/winsup/cygwin/math/acosl.c
new file mode 100644
index 0000000..511b5de
--- /dev/null
+++ b/winsup/cygwin/math/acosl.c
@@ -0,0 +1,22 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+long double acosl (long double x);
+
+long double acosl (long double x)
+{
+ long double res = 0.0L;
+
+ /* acosl = atanl (sqrtl(1 - x^2) / x) */
+ asm ( "fld %%st\n\t"
+ "fmul %%st(0)\n\t" /* x^2 */
+ "fld1\n\t"
+ "fsubp\n\t" /* 1 - x^2 */
+ "fsqrt\n\t" /* sqrtl (1 - x^2) */
+ "fxch %%st(1)\n\t"
+ "fpatan"
+ : "=t" (res) : "0" (x) : "st(1)");
+ return res;
+}
diff --git a/winsup/cygwin/math/asinhl.c b/winsup/cygwin/math/asinhl.c
new file mode 100644
index 0000000..bb2ca97
--- /dev/null
+++ b/winsup/cygwin/math/asinhl.c
@@ -0,0 +1,33 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <math.h>
+#include <errno.h>
+#include "fastmath.h"
+
+ /* asinh(x) = copysign(log(fabs(x) + sqrt(x * x + 1.0)), x) */
+long double asinhl(long double x)
+{
+ long double z;
+ if (!isfinite (x))
+ return x;
+
+ z = fabsl (x);
+
+ /* Avoid setting FPU underflow exception flag in x * x. */
+#if 0
+ if ( z < 0x1p-32)
+ return x;
+#endif
+
+ /* Use log1p to avoid cancellation with small x. Put
+ x * x in denom, so overflow is harmless.
+ asinh(x) = log1p (x + sqrt (x * x + 1.0) - 1.0)
+ = log1p (x + x * x / (sqrt (x * x + 1.0) + 1.0)) */
+
+ z = __fast_log1pl (z + z * z / (__fast_sqrtl (z * z + 1.0L) + 1.0L));
+
+ return ( x > 0.0 ? z : -z);
+}
diff --git a/winsup/cygwin/math/asinl.c b/winsup/cygwin/math/asinl.c
new file mode 100644
index 0000000..a4d8746
--- /dev/null
+++ b/winsup/cygwin/math/asinl.c
@@ -0,0 +1,27 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ * Adapted for long double type by Danny Smith <dannysmith@users.sourceforge.net>.
+ */
+
+/* asin = atan (x / sqrt(1 - x^2)) */
+long double asinl (long double x);
+
+long double asinl (long double x)
+{
+ long double res = 0.0L;
+
+ asm ( "fld %%st\n\t"
+ "fmul %%st(0)\n\t" /* x^2 */
+ "fld1\n\t"
+ "fsubp\n\t" /* 1 - x^2 */
+ "fsqrt\n\t" /* sqrt (1 - x^2) */
+ "fpatan"
+ : "=t" (res) : "0" (x) : "st(1)");
+ return res;
+}
diff --git a/winsup/cygwin/math/atan2l.c b/winsup/cygwin/math/atan2l.c
new file mode 100644
index 0000000..a32b097
--- /dev/null
+++ b/winsup/cygwin/math/atan2l.c
@@ -0,0 +1,14 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+long double atan2l (long double y, long double x);
+
+long double
+atan2l (long double y, long double x)
+{
+ long double res = 0.0L;
+ asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)");
+ return res;
+}
diff --git a/winsup/cygwin/math/atanhl.c b/winsup/cygwin/math/atanhl.c
new file mode 100644
index 0000000..59eb1bd
--- /dev/null
+++ b/winsup/cygwin/math/atanhl.c
@@ -0,0 +1,34 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <math.h>
+#include <errno.h>
+#include "fastmath.h"
+
+/* atanh (x) = 0.5 * log ((1.0 + x)/(1.0 - x)) */
+long double atanhl (long double x)
+{
+ long double z;
+ if (isnan (x))
+ return x;
+ z = fabsl (x);
+ if (z == 1.0L)
+ {
+ errno = ERANGE;
+ return (x > 0 ? INFINITY : -INFINITY);
+ }
+ if ( z > 1.0L)
+ {
+ errno = EDOM;
+ return nanl("");
+ }
+ /* Rearrange formula to avoid precision loss for small x.
+ atanh(x) = 0.5 * log ((1.0 + x)/(1.0 - x))
+ = 0.5 * log1p ((1.0 + x)/(1.0 - x) - 1.0)
+ = 0.5 * log1p ((1.0 + x - 1.0 + x) /(1.0 - x))
+ = 0.5 * log1p ((2.0 * x ) / (1.0 - x)) */
+ z = 0.5L * __fast_log1pl ((z + z) / (1.0L - z));
+ return x >= 0 ? z : -z;
+}
diff --git a/winsup/cygwin/math/atanl.c b/winsup/cygwin/math/atanl.c
new file mode 100644
index 0000000..b85d053
--- /dev/null
+++ b/winsup/cygwin/math/atanl.c
@@ -0,0 +1,17 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+long double atanl (long double x);
+
+long double
+atanl (long double x)
+{
+ long double res = 0.0L;
+
+ asm ("fld1\n\t"
+ "fpatan"
+ : "=t" (res) : "0" (x));
+ return res;
+}
diff --git a/winsup/cygwin/math/cabs.def.h b/winsup/cygwin/math/cabs.def.h
new file mode 100644
index 0000000..b3ea097
--- /dev/null
+++ b/winsup/cygwin/math/cabs.def.h
@@ -0,0 +1,49 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+__FLT_TYPE __cdecl
+__FLT_ABI(cabs) (__FLT_TYPE __complex__ z)
+{
+ return __FLT_ABI(hypot) (__real__ z, __imag__ z);
+}
diff --git a/winsup/cygwin/math/cabsl.c b/winsup/cygwin/math/cabsl.c
new file mode 100644
index 0000000..c750e87
--- /dev/null
+++ b/winsup/cygwin/math/cabsl.c
@@ -0,0 +1,48 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+/* long double version of the functions. */
+#define _NEW_COMPLEX_LDOUBLE 1
+#include "complex_internal.h"
+#include "cabs.def.h"
diff --git a/winsup/cygwin/math/cacos.def.h b/winsup/cygwin/math/cacos.def.h
new file mode 100644
index 0000000..300faff
--- /dev/null
+++ b/winsup/cygwin/math/cacos.def.h
@@ -0,0 +1,57 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+__FLT_TYPE __complex__ __cdecl
+__FLT_ABI(cacos) (__FLT_TYPE __complex__ z)
+{
+ __complex__ __FLT_TYPE x;
+ __complex__ __FLT_TYPE ret;
+
+ x = __FLT_ABI(casin) (z);
+
+ __real__ ret = (__FLT_TYPE) __FLT_PI_2 - __real__ x;
+ __imag__ ret = -__imag__ x;
+
+ return ret;
+}
diff --git a/winsup/cygwin/math/cacosh.def.h b/winsup/cygwin/math/cacosh.def.h
new file mode 100644
index 0000000..f4ea2da
--- /dev/null
+++ b/winsup/cygwin/math/cacosh.def.h
@@ -0,0 +1,100 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+__FLT_TYPE __complex__ __cdecl
+__FLT_ABI(cacosh) (__FLT_TYPE __complex__ z)
+{
+ __complex__ __FLT_TYPE ret;
+ __complex__ __FLT_TYPE x;
+ int r_class = fpclassify (__real__ z);
+ int i_class = fpclassify (__imag__ z);
+
+ if (i_class == FP_INFINITE)
+ {
+ __real__ ret = __FLT_HUGE_VAL;
+ __imag__ ret = (r_class == FP_NAN ? __FLT_NAN : __FLT_ABI(copysign) (
+ (r_class == FP_INFINITE ? (__real__ z < __FLT_CST(0.0) ? __FLT_PI_3_4 : __FLT_PI_4) : __FLT_PI_2), __imag__ z));
+ return ret;
+ }
+
+ if (r_class == FP_INFINITE)
+ {
+ __real__ ret = __FLT_HUGE_VAL;
+ __imag__ ret = ((i_class != FP_NAN && i_class != FP_INFINITE)
+ ? __FLT_ABI(copysign) (signbit (__real__ z) ? __FLT_PI : __FLT_CST(0.0), __imag__ z) : __FLT_NAN);
+ return ret;
+ }
+
+ if (r_class == FP_NAN || i_class == FP_NAN)
+ {
+ __real__ ret = __FLT_NAN;
+ __imag__ ret = __FLT_NAN;
+ return ret;
+ }
+
+ if (r_class == FP_ZERO && i_class == FP_ZERO)
+ {
+ __real__ ret = __FLT_CST(0.0);
+ __imag__ ret = __FLT_ABI(copysign) (__FLT_PI_2, __imag__ z);
+ return ret;
+ }
+
+ __real__ x = (__real__ z - __imag__ z) * (__real__ z + __imag__ z) - __FLT_CST(1.0);
+ __imag__ x = __FLT_CST(2.0) * __real__ z * __imag__ z;
+
+ x = __FLT_ABI(csqrt) (x);
+
+ if (__real__ z < __FLT_CST(0.0))
+ x = -x;
+
+ __real__ x += __real__ z;
+ __imag__ x += __imag__ z;
+
+ ret = __FLT_ABI(clog) (x);
+
+ if (__real__ ret < __FLT_CST(0.0))
+ ret = -ret;
+
+ return ret;
+}
diff --git a/winsup/cygwin/math/cacosl.c b/winsup/cygwin/math/cacosl.c
new file mode 100644
index 0000000..7a8df65
--- /dev/null
+++ b/winsup/cygwin/math/cacosl.c
@@ -0,0 +1,50 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+/* long double version of the functions. */
+#define _NEW_COMPLEX_LDOUBLE 1
+#include "complex_internal.h"
+
+#include "cacosh.def.h"
+#include "cacos.def.h"
diff --git a/winsup/cygwin/math/carg.def.h b/winsup/cygwin/math/carg.def.h
new file mode 100644
index 0000000..2ccf841
--- /dev/null
+++ b/winsup/cygwin/math/carg.def.h
@@ -0,0 +1,49 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+__FLT_TYPE __cdecl
+__FLT_ABI(carg) (__FLT_TYPE __complex__ z)
+{
+ return __FLT_ABI(atan2) (__imag__ z, __real__ z);
+}
diff --git a/winsup/cygwin/math/cargl.c b/winsup/cygwin/math/cargl.c
new file mode 100644
index 0000000..e70f580
--- /dev/null
+++ b/winsup/cygwin/math/cargl.c
@@ -0,0 +1,48 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+/* long double version of the functions. */
+#define _NEW_COMPLEX_LDOUBLE 1
+#include "complex_internal.h"
+#include "carg.def.h"
diff --git a/winsup/cygwin/math/casin.def.h b/winsup/cygwin/math/casin.def.h
new file mode 100644
index 0000000..808c1be
--- /dev/null
+++ b/winsup/cygwin/math/casin.def.h
@@ -0,0 +1,61 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+__FLT_TYPE __complex__ __cdecl
+__FLT_ABI(casin) (__FLT_TYPE __complex__ z)
+{
+ /* Annex G.6: casin(z) = -i casinh (iz) */
+ __complex__ __FLT_TYPE ret;
+ __complex__ __FLT_TYPE x;
+
+ __real__ x = -__imag__ z;
+ __imag__ x = __real__ z;
+
+ x = __FLT_ABI(casinh) (x);
+
+ __real__ ret = __imag__ x;
+ __imag__ ret = -__real__ x;
+
+ return ret;
+}
diff --git a/winsup/cygwin/math/casinh.def.h b/winsup/cygwin/math/casinh.def.h
new file mode 100644
index 0000000..050d885
--- /dev/null
+++ b/winsup/cygwin/math/casinh.def.h
@@ -0,0 +1,99 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+__FLT_TYPE __complex__ __cdecl
+__FLT_ABI(casinh) (__FLT_TYPE __complex__ z)
+{
+ __complex__ __FLT_TYPE ret;
+ __complex__ __FLT_TYPE x;
+ int r_class = fpclassify (__real__ z);
+ int i_class = fpclassify (__imag__ z);
+
+ if (i_class == FP_INFINITE)
+ {
+ __real__ ret = __FLT_ABI(copysign) (__FLT_HUGE_VAL, __real__ z);
+ __imag__ ret = (r_class == FP_NAN
+ ? __FLT_NAN
+ : (__FLT_ABI(copysign) ((r_class != FP_NAN && r_class != FP_INFINITE) ? __FLT_PI_2 : __FLT_PI_4, __imag__ z)));
+ return ret;
+ }
+
+ if (r_class == FP_INFINITE)
+ {
+ __real__ ret = __real__ z;
+ __imag__ ret = (i_class != FP_NAN
+ ? __FLT_ABI(copysign) (__FLT_CST(0.0), __imag__ z)
+ : __FLT_NAN);
+ return ret;
+ }
+
+ if (r_class == FP_NAN)
+ {
+ __real__ ret = __real__ z;
+ __imag__ ret = (i_class == FP_ZERO
+ ? __FLT_ABI(copysign) (__FLT_CST(0.0), __imag__ z)
+ : __FLT_NAN);
+ return ret;
+ }
+
+ if (i_class == FP_NAN)
+ {
+ __real__ ret = __FLT_NAN;
+ __imag__ ret = __FLT_NAN;
+ return ret;
+ }
+
+ if (r_class == FP_ZERO && i_class == FP_ZERO)
+ return z;
+
+ __real__ x = (__real__ z - __imag__ z) * (__real__ z + __imag__ z) + __FLT_CST(1.0);
+ __imag__ x = __FLT_CST(2.0) * __real__ z * __imag__ z;
+
+ x = __FLT_ABI(csqrt) (x);
+
+ __real__ x += __real__ z;
+ __imag__ x += __imag__ z;
+
+ return __FLT_ABI(clog) (x);
+}
diff --git a/winsup/cygwin/math/casinl.c b/winsup/cygwin/math/casinl.c
new file mode 100644
index 0000000..1d7e247
--- /dev/null
+++ b/winsup/cygwin/math/casinl.c
@@ -0,0 +1,50 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+/* long double version of the functions. */
+#define _NEW_COMPLEX_LDOUBLE 1
+#include "complex_internal.h"
+
+#include "casinh.def.h"
+#include "casin.def.h"
diff --git a/winsup/cygwin/math/catan.def.h b/winsup/cygwin/math/catan.def.h
new file mode 100644
index 0000000..19db6b7
--- /dev/null
+++ b/winsup/cygwin/math/catan.def.h
@@ -0,0 +1,61 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+__FLT_TYPE __complex__ __cdecl
+__FLT_ABI(catan) (__FLT_TYPE __complex__ z)
+{
+ /* Annex G.6: catan(z) = -i catanh (iz) */
+ __complex__ __FLT_TYPE ret;
+ __complex__ __FLT_TYPE x;
+
+ __real__ x = -__imag__ z;
+ __imag__ x = __real__ z;
+
+ x = __FLT_ABI(catanh) (x);
+
+ __real__ ret = __imag__ x;
+ __imag__ ret = -__real__ x;
+
+ return ret;
+}
diff --git a/winsup/cygwin/math/catanh.def.h b/winsup/cygwin/math/catanh.def.h
new file mode 100644
index 0000000..68949d1
--- /dev/null
+++ b/winsup/cygwin/math/catanh.def.h
@@ -0,0 +1,93 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+__FLT_TYPE __complex__ __cdecl
+__FLT_ABI(catanh) (__FLT_TYPE __complex__ z)
+{
+ __complex__ __FLT_TYPE ret;
+ __FLT_TYPE i2, n, d;
+ int r_class = fpclassify (__real__ z);
+ int i_class = fpclassify (__imag__ z);
+
+ if (r_class == FP_INFINITE || r_class == FP_NAN || i_class == FP_INFINITE || i_class == FP_NAN)
+ {
+ if (i_class == FP_INFINITE)
+ {
+ __real__ ret = __FLT_ABI(copysign) (__FLT_CST(0.0), __real__ z);
+ __imag__ ret = __FLT_ABI(copysign) (__FLT_PI_2, __imag__ z);
+ return ret;
+ }
+
+ if (r_class == FP_INFINITE || r_class == FP_ZERO)
+ {
+ __real__ ret = __FLT_ABI(copysign) (__FLT_CST(0.0), __real__ z);
+ __imag__ ret = ((i_class != FP_NAN && i_class != FP_INFINITE)
+ ? __FLT_ABI(copysign) (__FLT_PI_2, __imag__ z) : __FLT_NAN);
+ return ret;
+ }
+
+ __real__ ret = __FLT_NAN;
+ __imag__ ret = __FLT_NAN;
+ return ret;
+ }
+
+ if (r_class == FP_ZERO && i_class == FP_ZERO)
+ return z;
+
+ i2 = __imag__ z * __imag__ z;
+
+ n = __FLT_CST(1.0) + __real__ z;
+ n = i2 + n * n;
+
+ d = __FLT_CST(1.0) - __real__ z;
+ d = i2 + d * d;
+
+ __real__ ret = __FLT_CST(0.25) * (__FLT_ABI(log) (n) - __FLT_ABI(log) (d));
+
+ d = 1 - __real__ z * __real__ z - i2;
+
+ __imag__ ret = __FLT_CST(0.5) * __FLT_ABI(atan2) (__FLT_CST(2.0) * __imag__ z, d);
+
+ return ret;
+}
diff --git a/winsup/cygwin/math/catanl.c b/winsup/cygwin/math/catanl.c
new file mode 100644
index 0000000..9c1ccdf
--- /dev/null
+++ b/winsup/cygwin/math/catanl.c
@@ -0,0 +1,50 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+/* long double version of the functions. */
+#define _NEW_COMPLEX_LDOUBLE 1
+#include "complex_internal.h"
+
+#include "catanh.def.h"
+#include "catan.def.h"
diff --git a/winsup/cygwin/math/cbrtl.c b/winsup/cygwin/math/cbrtl.c
new file mode 100644
index 0000000..95074e9
--- /dev/null
+++ b/winsup/cygwin/math/cbrtl.c
@@ -0,0 +1,80 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <math.h>
+
+static const long double CBRT2 = 1.2599210498948731647672L;
+static const long double CBRT4 = 1.5874010519681994747517L;
+static const long double CBRT2I = 0.79370052598409973737585L;
+static const long double CBRT4I = 0.62996052494743658238361L;
+
+long double cbrtl(long double x)
+{
+ int e, rem, sign;
+ long double z;
+
+ if (!isfinite (x) || x == 0.0L)
+ return (x);
+
+ if (x > 0)
+ sign = 1;
+ else
+ {
+ sign = -1;
+ x = -x;
+ }
+
+ z = x;
+ /* extract power of 2, leaving
+ * mantissa between 0.5 and 1
+ */
+ x = frexpl(x, &e);
+
+ /* Approximate cube root of number between .5 and 1,
+ * peak relative error = 1.2e-6
+ */
+ x = (((( 1.3584464340920900529734e-1L * x
+ - 6.3986917220457538402318e-1L) * x
+ + 1.2875551670318751538055e0L) * x
+ - 1.4897083391357284957891e0L) * x
+ + 1.3304961236013647092521e0L) * x
+ + 3.7568280825958912391243e-1L;
+
+ /* exponent divided by 3 */
+ if (e >= 0)
+ {
+ rem = e;
+ e /= 3;
+ rem -= 3*e;
+ if (rem == 1)
+ x *= CBRT2;
+ else if (rem == 2)
+ x *= CBRT4;
+ }
+ else
+ { /* argument less than 1 */
+ e = -e;
+ rem = e;
+ e /= 3;
+ rem -= 3*e;
+ if (rem == 1)
+ x *= CBRT2I;
+ else if (rem == 2)
+ x *= CBRT4I;
+ e = -e;
+ }
+
+ /* multiply by power of 2 */
+ x = ldexpl(x, e);
+
+ /* Newton iteration */
+
+ x -= ( x - (z/(x*x)) )*0.3333333333333333333333L;
+ x -= ( x - (z/(x*x)) )*0.3333333333333333333333L;
+
+ if (sign < 0)
+ x = -x;
+ return (x);
+}
diff --git a/winsup/cygwin/math/ccos.def.h b/winsup/cygwin/math/ccos.def.h
new file mode 100644
index 0000000..2e7472c
--- /dev/null
+++ b/winsup/cygwin/math/ccos.def.h
@@ -0,0 +1,54 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+__FLT_TYPE __complex__ __cdecl
+__FLT_ABI(ccos) (__FLT_TYPE __complex__ z)
+{
+ /* Annex G.6, ccos(z) = ccosh(iz) */
+ __complex__ __FLT_TYPE x;
+ __real__ x = -__imag__ z;
+ __imag__ x = __real__ z;
+
+ return __FLT_ABI(ccosh) (x);
+}
diff --git a/winsup/cygwin/math/ccosh.def.h b/winsup/cygwin/math/ccosh.def.h
new file mode 100644
index 0000000..c18d657
--- /dev/null
+++ b/winsup/cygwin/math/ccosh.def.h
@@ -0,0 +1,95 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+__FLT_TYPE __complex__ __cdecl
+__FLT_ABI(ccosh) (__FLT_TYPE __complex__ z)
+{
+ __complex__ __FLT_TYPE ret;
+ __FLT_TYPE s_x, c_x;
+ int r_class = fpclassify (__real__ z);
+ int i_class = fpclassify (__imag__ z);
+
+ if (r_class == FP_NAN)
+ {
+ __real__ ret = __FLT_NAN;
+ __imag__ ret = __imag__ z == __FLT_CST(0.0) ? __imag__ z : __FLT_NAN;
+ return ret;
+ }
+
+ if (r_class == FP_INFINITE)
+ {
+ if (i_class == FP_ZERO)
+ {
+ __real__ ret = __FLT_HUGE_VAL;
+ __imag__ ret = __imag__ z * __FLT_ABI(copysign) (__FLT_CST(1.0), __real__ z);
+ return ret;
+ }
+
+ if (i_class == FP_NAN || i_class == FP_INFINITE)
+ {
+ __real__ ret = __FLT_HUGE_VAL;
+ __imag__ ret = __FLT_NAN + __FLT_NAN;
+ return ret;
+ }
+
+ __FLT_ABI(sincos) (__imag__ z, &s_x, &c_x);
+
+ __real__ ret = __FLT_ABI(copysign) (__FLT_HUGE_VAL, c_x);
+ __imag__ ret = (__FLT_ABI(copysign) (__FLT_HUGE_VAL, s_x) * __FLT_ABI(copysign) (__FLT_CST(1.0), __real__ z));
+ return ret;
+ }
+
+ if (i_class == FP_NAN || i_class == FP_INFINITE)
+ {
+ __imag__ ret = __real__ z == __FLT_CST(0.0) ? __FLT_CST(0.0) : __FLT_NAN;
+ __real__ ret = __FLT_NAN + __FLT_NAN;
+ return ret;
+ }
+
+ __FLT_ABI(sincos) (__imag__ z, &s_x, &c_x);
+
+ __real__ ret = __FLT_ABI(cosh) (__real__ z) * c_x;
+ __imag__ ret = __FLT_ABI(sinh) (__real__ z) * s_x;
+ return ret;
+}
diff --git a/winsup/cygwin/math/ccosl.c b/winsup/cygwin/math/ccosl.c
new file mode 100644
index 0000000..594a4d1
--- /dev/null
+++ b/winsup/cygwin/math/ccosl.c
@@ -0,0 +1,50 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ 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 COPYRIGHT HOLDERS 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.
+*/
+
+/* long double version of the functions. */
+#define _NEW_COMPLEX_LDOUBLE 1
+#include "complex_internal.h"
+
+#include "ccosh.def.h"
+#include "ccos.def.h"
diff --git a/winsup/cygwin/math/ceil.S b/winsup/cygwin/math/ceil.S
new file mode 100644
index 0000000..636df1e
--- /dev/null
+++ b/winsup/cygwin/math/ceil.S
@@ -0,0 +1,124 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+ .file "ceil.S"
+ .text
+ .align 4
+ .globl __MINGW_USYMBOL(ceil)
+ .def __MINGW_USYMBOL(ceil); .scl 2; .type 32; .endef
+#ifdef __x86_64__
+ .seh_proc __MINGW_USYMBOL(ceil)
+#endif
+
+__MINGW_USYMBOL(ceil):
+#if defined(_AMD64_) || defined(__x86_64__)
+ .seh_endprologue
+ movd %xmm0, %rax
+ movq %rax, %rcx
+ sarq $52, %rcx
+ andl $2047, %ecx
+ subl $1023, %ecx
+ cmpl $51, %ecx
+ jg .is_intnaninf
+ /* Is x zero? */
+ testq %rax, %rax
+ je .ret_org
+ /* Is x signed? */
+ testl %ecx, %ecx
+ js .signed_val
+ /* Is x integral? */
+ movabsq $4503599627370495, %rdx
+ sarq %cl, %rdx
+ testq %rax, %rdx
+ je .ret_org
+ addsd .huge(%rip), %xmm0
+ ucomisd .zero(%rip), %xmm0
+ jbe .doret
+ testq %rax, %rax
+ jle .l1
+ /* inexact ... */
+ movabsq $4503599627370496, %r8
+ shrq %cl, %r8
+ addq %r8, %rax
+.l1:
+ notq %rdx
+ andq %rdx, %rax
+.doret:
+ movd %rax, %xmm0
+ ret
+ .p2align 4,,10
+.signed_val:
+ addsd .huge(%rip), %xmm0
+ ucomisd .zero(%rip), %xmm0
+ jbe .doret2
+ testq %rax, %rax
+ movabsq $4607182418800017408, %rdx
+ movabsq $-9223372036854775808, %rax
+ cmovns %rdx, %rax
+ .p2align 4,,10
+.doret2:
+ movd %rax, %xmm0
+ ret
+
+ .p2align 4,,10
+.is_intnaninf:
+ /* Is Nan or Inf? */
+ cmpl $1024, %ecx
+ je .ret_naninf
+ .p2align 4,,10
+.ret_org:
+ /* return x. */
+ rep
+ ret
+ .p2align 4,,10
+.ret_naninf:
+ /* return x + x; */
+ addsd %xmm0, %xmm0
+ ret
+ .seh_endproc
+
+/* local data. */
+ .section .rdata,"dr"
+ .align 8
+.huge:
+ .long -2013235812
+ .long 2117592124
+ .align 8
+.zero:
+ .long 0
+ .long 0
+#elif defined(_ARM_) || defined(__arm__)
+ vmrs r1, fpscr
+ bic r0, r1, #0x00c00000
+ orr r0, r0, #0x00400000 /* Round towards Plus Infinity */
+ vmsr fpscr, r0
+ vcvtr.s32.f64 s0, d0
+ vcvt.f64.s32 d0, s0
+ vmsr fpscr, r1
+ bx lr
+#elif defined(_X86_) || defined(__i386__)
+ fldl 4(%esp)
+ subl $8,%esp
+
+ fstcw 4(%esp) /* store fpu control word */
+
+ /* We use here %edx although only the low 1 bits are defined.
+ But none of the operations should care and they are faster
+ than the 16 bit operations. */
+ movl $0x0800,%edx /* round towards +oo */
+ orl 4(%esp),%edx
+ andl $0xfbff,%edx
+ movl %edx,(%esp)
+ fldcw (%esp) /* load modified control word */
+
+ frndint /* round */
+
+ fldcw 4(%esp) /* restore original control word */
+
+ addl $8,%esp
+ ret
+#endif
diff --git a/winsup/cygwin/math/ceilf.S b/winsup/cygwin/math/ceilf.S
new file mode 100644
index 0000000..605c7bf
--- /dev/null
+++ b/winsup/cygwin/math/ceilf.S
@@ -0,0 +1,120 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+ .file "ceilf.S"
+ .text
+ .align 4
+ .globl __MINGW_USYMBOL(ceilf)
+ .def __MINGW_USYMBOL(ceilf); .scl 2; .type 32; .endef
+#ifdef __x86_64__
+ .seh_proc __MINGW_USYMBOL(ceilf)
+#endif
+
+__MINGW_USYMBOL(ceilf):
+#if defined(_AMD64_) || defined(__x86_64__)
+ subq $24, %rsp
+ .seh_stackalloc 24
+ .seh_endprologue
+ movd %xmm0, 12(%rsp)
+ movl 12(%rsp), %eax
+ movl %eax, %ecx
+ movl %eax, %edx
+ sarl $23, %ecx
+ andl $255, %ecx
+ subl $127, %ecx
+ cmpl $22, %ecx
+ jg .l4
+ testl %ecx, %ecx
+ js .l5
+ movl $8388607, %r8d
+ sarl %cl, %r8d
+ testl %eax, %r8d
+ je .l3
+ addss .hugeval(%rip), %xmm0
+ ucomiss .zeroval(%rip), %xmm0
+ jbe .l2
+ testl %eax, %eax
+ jle .l1
+ movl $8388608, %eax
+ sarl %cl, %eax
+ addl %eax, %edx
+.l1:
+ movl %r8d, %eax
+ notl %eax
+ andl %edx, %eax
+.l2:
+ movl %eax, 8(%rsp)
+ movss 8(%rsp), %xmm0
+.l3:
+ addq $24, %rsp
+ ret
+ .p2align 4,,10
+.l4:
+ addl $-128, %ecx
+ jne .l3
+ addss %xmm0, %xmm0
+ addq $24, %rsp
+ ret
+ .p2align 4,,10
+.l5:
+ addss .hugeval(%rip), %xmm0
+ ucomiss .zeroval(%rip), %xmm0
+ jbe .islesseqzero
+ testl %eax, %eax
+ js .l6
+ movl $1065353216, %edx
+ cmovne %edx, %eax
+.islesseqzero:
+ movl %eax, 8(%rsp)
+ movss 8(%rsp), %xmm0
+ addq $24, %rsp
+ ret
+ .p2align 4,,10
+.l6:
+ movl $-2147483648, 8(%rsp)
+ movss 8(%rsp), %xmm0
+ addq $24, %rsp
+ ret
+ .seh_endproc
+ .section .rdata,"dr"
+ .align 4
+.hugeval:
+ .long 1900671690
+ .align 4
+.zeroval:
+ .long 0
+#elif defined(_ARM_) || defined(__arm__)
+ vmrs r1, fpscr
+ bic r0, r1, #0x00c00000
+ orr r0, r0, #0x00400000 /* Round towards Plus Infinity */
+ vmsr fpscr, r0
+ vcvt.s32.f32 s0, s0
+ vcvt.f32.s32 s0, s0
+ vmsr fpscr, r1
+ bx lr
+#elif defined(_X86_) || defined(__i386__)
+ flds 4(%esp)
+ subl $8,%esp
+
+ fstcw 4(%esp) /* store fpu control word */
+
+ /* We use here %edx although only the low 1 bits are defined.
+ But none of the operations should care and they are faster
+ than the 16 bit operations. */
+ movl $0x0800,%edx /* round towards +oo */
+ orl 4(%esp),%edx
+ andl $0xfbff,%edx
+ movl %edx,(%esp)
+ fldcw (%esp) /* load modified control word */
+
+ frndint /* round */
+
+ fldcw 4(%esp) /* restore original control word */
+
+ addl $8,%esp
+ ret
+#endif
diff --git a/winsup/cygwin/math/ceill.S b/winsup/cygwin/math/ceill.S
new file mode 100644
index 0000000..61d6199
--- /dev/null
+++ b/winsup/cygwin/math/ceill.S
@@ -0,0 +1,64 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+ .file "ceill.S"
+ .text
+#ifdef __x86_64__
+ .align 8
+#else
+ .align 4
+#endif
+ .globl __MINGW_USYMBOL(ceill)
+ .def __MINGW_USYMBOL(ceill); .scl 2; .type 32; .endef
+__MINGW_USYMBOL(ceill):
+#if defined(_AMD64_) || defined(__x86_64__)
+ fldt (%rdx)
+ subq $24,%rsp
+
+ fstcw 8(%rsp) /* store fpu control word */
+
+ /* We use here %edx although only the low 1 bits are defined.
+ But none of the operations should care and they are faster
+ than the 16 bit operations. */
+ movl $0x0800,%edx /* round towards +oo */
+ orl 8(%rsp),%edx
+ andl $0xfbff,%edx
+ movl %edx,(%rsp)
+ fldcw (%rsp) /* load modified control word */
+
+ frndint /* round */
+
+ fldcw 8(%rsp) /* restore original control word */
+
+ addq $24,%rsp
+ movq %rcx,%rax
+ movq $0,8(%rcx)
+ fstpt (%rcx)
+ ret
+#elif defined(_ARM_) || defined(__arm__)
+ vmrs r1, fpscr
+ bic r0, r1, #0x00c00000
+ orr r0, r0, #0x00400000 /* Round towards Plus Infinity */
+ vmsr fpscr, r0
+ vcvtr.s32.f64 s0, d0
+ vcvt.f64.s32 d0, s0
+ vmsr fpscr, r1
+ bx lr
+#elif defined(_X86_) || defined(__i386__)
+ fldt 4(%esp)
+ subl $8,%esp
+ fstcw 4(%esp)
+ movl $0x0800,%edx
+ orl 4(%esp),%edx
+ andl $0xfbff,%edx
+ movl %edx,(%esp)
+ fldcw (%esp)
+ frndint
+ fldcw 4(%esp)
+ addl $8,%esp
+ ret
+#endif
diff --git a/winsup/cygwin/math/cephes_emath.c b/winsup/cygwin/math/cephes_emath.c
new file mode 100644
index 0000000..8fb4434
--- /dev/null
+++ b/winsup/cygwin/math/cephes_emath.c
@@ -0,0 +1,1283 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include "cephes_emath.h"
+
+/*
+ * The constants are for 64 bit precision.
+ */
+
+
+/* Move in external format number,
+ * converting it to internal format.
+ */
+void __emovi(const short unsigned int * __restrict__ a,
+ short unsigned int * __restrict__ b)
+{
+ register const unsigned short *p;
+ register unsigned short *q;
+ int i;
+
+ q = b;
+ p = a + (NE-1); /* point to last word of external number */
+ /* get the sign bit */
+ if (*p & 0x8000)
+ *q++ = 0xffff;
+ else
+ *q++ = 0;
+ /* get the exponent */
+ *q = *p--;
+ *q++ &= 0x7fff; /* delete the sign bit */
+#ifdef INFINITY
+ if ((*(q - 1) & 0x7fff) == 0x7fff)
+ {
+#ifdef NANS
+ if (__eisnan(a))
+ {
+ *q++ = 0;
+ for (i = 3; i < NI; i++ )
+ *q++ = *p--;
+ return;
+ }
+#endif
+ for (i = 2; i < NI; i++)
+ *q++ = 0;
+ return;
+ }
+#endif
+ /* clear high guard word */
+ *q++ = 0;
+ /* move in the significand */
+ for (i = 0; i < NE - 1; i++ )
+ *q++ = *p--;
+ /* clear low guard word */
+ *q = 0;
+}
+
+
+/*
+; Add significands
+; x + y replaces y
+*/
+
+void __eaddm(const short unsigned int * __restrict__ x,
+ short unsigned int * __restrict__ y)
+{
+ register unsigned long a;
+ int i;
+ unsigned int carry;
+
+ x += NI - 1;
+ y += NI - 1;
+ carry = 0;
+ for (i = M; i < NI; i++)
+ {
+ a = (unsigned long)(*x) + (unsigned long)(*y) + carry;
+ if (a & 0x10000)
+ carry = 1;
+ else
+ carry = 0;
+ *y = (unsigned short)a;
+ --x;
+ --y;
+ }
+}
+
+/*
+; Subtract significands
+; y - x replaces y
+*/
+
+void __esubm(const short unsigned int * __restrict__ x,
+ short unsigned int * __restrict__ y)
+{
+ unsigned long a;
+ int i;
+ unsigned int carry;
+
+ x += NI - 1;
+ y += NI - 1;
+ carry = 0;
+ for (i = M; i < NI; i++)
+ {
+ a = (unsigned long)(*y) - (unsigned long)(*x) - carry;
+ if (a & 0x10000)
+ carry = 1;
+ else
+ carry = 0;
+ *y = (unsigned short)a;
+ --x;
+ --y;
+ }
+}
+
+
+/* Multiply significand of e-type number b
+by 16-bit quantity a, e-type result to c. */
+
+static void __m16m(short unsigned int a,
+ short unsigned int * __restrict__ b,
+ short unsigned int * __restrict__ c)
+{
+ register unsigned short *pp;
+ register unsigned long carry;
+ unsigned short *ps;
+ unsigned short p[NI];
+ unsigned long aa, m;
+ int i;
+
+ aa = a;
+ pp = &p[NI - 2];
+ *pp++ = 0;
+ *pp = 0;
+ ps = &b[NI - 1];
+
+ for(i = M + 1; i < NI; i++)
+ {
+ if (*ps == 0)
+ {
+ --ps;
+ --pp;
+ *(pp - 1) = 0;
+ }
+ else
+ {
+ m = (unsigned long) aa * *ps--;
+ carry = (m & 0xffff) + *pp;
+ *pp-- = (unsigned short)carry;
+ carry = (carry >> 16) + (m >> 16) + *pp;
+ *pp = (unsigned short)carry;
+ *(pp - 1) = carry >> 16;
+ }
+ }
+ for (i = M; i < NI; i++)
+ c[i] = p[i];
+}
+
+
+/* Divide significands. Neither the numerator nor the denominator
+is permitted to have its high guard word nonzero. */
+
+int __edivm(short unsigned int * __restrict__ den,
+ short unsigned int * __restrict__ num)
+{
+ int i;
+ register unsigned short *p;
+ unsigned long tnum;
+ unsigned short j, tdenm, tquot;
+ unsigned short tprod[NI + 1];
+ unsigned short equot[NI];
+
+ p = &equot[0];
+ *p++ = num[0];
+ *p++ = num[1];
+
+ for (i = M; i < NI; i++)
+ {
+ *p++ = 0;
+ }
+ __eshdn1(num);
+ tdenm = den[M + 1];
+ for (i = M; i < NI; i++)
+ {
+ /* Find trial quotient digit (the radix is 65536). */
+ tnum = (((unsigned long) num[M]) << 16) + num[M + 1];
+
+ /* Do not execute the divide instruction if it will overflow. */
+ if ((tdenm * 0xffffUL) < tnum)
+ tquot = 0xffff;
+ else
+ tquot = tnum / tdenm;
+
+ /* Prove that the divide worked. */
+ /*
+ tcheck = (unsigned long)tquot * tdenm;
+ if (tnum - tcheck > tdenm)
+ tquot = 0xffff;
+ */
+ /* Multiply denominator by trial quotient digit. */
+ __m16m(tquot, den, tprod);
+ /* The quotient digit may have been overestimated. */
+ if (__ecmpm(tprod, num) > 0)
+ {
+ tquot -= 1;
+ __esubm(den, tprod);
+ if(__ecmpm(tprod, num) > 0)
+ {
+ tquot -= 1;
+ __esubm(den, tprod);
+ }
+ }
+ __esubm(tprod, num);
+ equot[i] = tquot;
+ __eshup6(num);
+ }
+ /* test for nonzero remainder after roundoff bit */
+ p = &num[M];
+ j = 0;
+ for (i = M; i < NI; i++)
+ {
+ j |= *p++;
+ }
+ if (j)
+ j = 1;
+
+ for (i = 0; i < NI; i++)
+ num[i] = equot[i];
[...]
[diff truncated at 100000 bytes]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-29 13:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-29 13:04 [newlib-cygwin] Add missing long double functions to Cygwin Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).