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>
This commit is contained in:
Corinna Vinschen 2016-03-28 19:35:20 +02:00
parent 087aca6163
commit 792e51b721
142 changed files with 10969 additions and 42 deletions

View File

@ -108,12 +108,10 @@ long double cimagl(long double complex);
/* 7.3.9.3 The conj functions */ /* 7.3.9.3 The conj functions */
double complex conj(double complex); double complex conj(double complex);
float complex conjf(float complex); float complex conjf(float complex);
/*long double complex conjl(long double complex); */
/* 7.3.9.4 The cproj functions */ /* 7.3.9.4 The cproj functions */
double complex cproj(double complex); double complex cproj(double complex);
float complex cprojf(float complex); float complex cprojf(float complex);
/*long double complex cprojl(long double complex); */
/* 7.3.9.5 The creal functions */ /* 7.3.9.5 The creal functions */
double creal(double complex); double creal(double complex);
@ -125,6 +123,31 @@ double complex clog10(double complex);
float complex clog10f(float complex); float complex clog10f(float complex);
#endif #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 __END_DECLS
#endif /* ! _COMPLEX_H */ #endif /* ! _COMPLEX_H */

View File

@ -421,8 +421,12 @@ extern float log2f _PARAMS((float));
extern float hypotf _PARAMS((float, float)); extern float hypotf _PARAMS((float, float));
#endif /* ! defined (_REENT_ONLY) */ #endif /* ! defined (_REENT_ONLY) */
/* On platforms where long double equals double. */ /* Newlib doesn't fully support long double math functions so far.
#ifdef _LDBL_EQ_DBL 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. */ /* Reentrant ANSI C functions. */
#ifndef __math_68881 #ifndef __math_68881
extern long double atanl _PARAMS((long double)); 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 erfl _PARAMS((long double));
extern long double erfcl _PARAMS((long double)); extern long double erfcl _PARAMS((long double));
#endif /* ! defined (_REENT_ONLY) */ #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 hypotl _PARAMS((long double, long double));
extern long double sqrtl _PARAMS((long double)); extern long double sqrtl _PARAMS((long double));
#ifdef __i386__ #ifdef __i386__
@ -501,13 +505,16 @@ extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE));
extern long int lrintl _PARAMS((_LONG_DOUBLE)); extern long int lrintl _PARAMS((_LONG_DOUBLE));
extern long long int llrintl _PARAMS((_LONG_DOUBLE)); extern long long int llrintl _PARAMS((_LONG_DOUBLE));
#endif /* __i386__ */ #endif /* __i386__ */
#endif /* !_LDBL_EQ_DBL */ #endif /* !_LDBL_EQ_DBL && !__CYGWIN__ */
#endif /* __ISO_C_VISIBLE >= 1999 */ #endif /* __ISO_C_VISIBLE >= 1999 */
#if __MISC_VISIBLE #if __MISC_VISIBLE
extern double drem _PARAMS((double, double)); extern double drem _PARAMS((double, double));
extern float dremf _PARAMS((float, float)); 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 gamma_r _PARAMS((double, int *));
extern double lgamma_r _PARAMS((double, int *)); extern double lgamma_r _PARAMS((double, int *));
extern float gammaf_r _PARAMS((float, int *)); extern float gammaf_r _PARAMS((float, int *));
@ -536,6 +543,9 @@ extern float jnf _PARAMS((int, float));
#if __GNU_VISIBLE #if __GNU_VISIBLE
extern void sincos _PARAMS((double, double *, double *)); extern void sincos _PARAMS((double, double *, double *));
extern void sincosf _PARAMS((float, float *, float *)); extern void sincosf _PARAMS((float, float *, float *));
#ifdef __CYGWIN__
extern void sincosl _PARAMS((long double, long double *, long double *));
#endif /* __CYGWIN__ */
# ifndef exp10 # ifndef exp10
extern double exp10 _PARAMS((double)); extern double exp10 _PARAMS((double));
# endif # endif
@ -548,6 +558,14 @@ extern float exp10f _PARAMS((float));
# ifndef pow10f # ifndef pow10f
extern float pow10f _PARAMS((float)); extern float pow10f _PARAMS((float));
# endif # endif
#ifdef __CYGWIN__
# ifndef exp10l
extern float exp10l _PARAMS((float));
# endif
# ifndef pow10l
extern float pow10l _PARAMS((float));
# endif
#endif /* __CYGWIN__ */
#endif /* __GNU_VISIBLE */ #endif /* __GNU_VISIBLE */
#if __MISC_VISIBLE || __XSI_VISIBLE #if __MISC_VISIBLE || __XSI_VISIBLE

View File

@ -79,7 +79,7 @@
__tg_type3(__e1, __e2, __e3, long double _Complex) || \ __tg_type3(__e1, __e2, __e3, long double _Complex) || \
__tg_type3(__e1, __e2, __e3, __typeof__(_Complex_I))) __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, ...) \ #define __tg_impl_simple(x, y, z, fn, fnf, fnl, ...) \
__builtin_choose_expr(__tg_type_corr(x, y, z, long double), \ __builtin_choose_expr(__tg_type_corr(x, y, z, long double), \
fnl(__VA_ARGS__), __builtin_choose_expr( \ fnl(__VA_ARGS__), __builtin_choose_expr( \
@ -161,9 +161,10 @@
#define lround(__x) __tg_simple(__x, lround) #define lround(__x) __tg_simple(__x, lround)
#define nearbyint(__x) __tg_simple(__x, nearbyint) #define nearbyint(__x) __tg_simple(__x, nearbyint)
#define nextafter(__x, __y) __tg_simple2(__x, __y, nextafter) #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) #define nexttoward(__x, __y) __tg_simplev(__x, nexttoward, __x, __y)
*/ #endif
#define remainder(__x, __y) __tg_simple2(__x, __y, remainder) #define remainder(__x, __y) __tg_simple2(__x, __y, remainder)
#define remquo(__x, __y, __z) __tg_impl_simple(__x, __x, __y, remquo, remquof, \ #define remquo(__x, __y, __z) __tg_impl_simple(__x, __x, __y, remquo, remquof, \
remquol, __x, __y, __z) remquol, __x, __y, __z)

View File

@ -29,7 +29,7 @@ export CCWRAP_HEADERS:=. ${srcdir}
export CCWRAP_SYSTEM_HEADERS:=@cygwin_headers@ @newlib_headers@ export CCWRAP_SYSTEM_HEADERS:=@cygwin_headers@ @newlib_headers@
export CCWRAP_DIRAFTER_HEADERS:=@windows_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_cpu:=@target_cpu@
target_alias:=@target_alias@ target_alias:=@target_alias@
@ -153,6 +153,101 @@ DLL_IMPORTS:=${shell $(CC) -print-file-name=w32api/libkernel32.a} ${shell $(CC)
MT_SAFE_OBJECTS:= 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:= \ DLL_OFILES:= \
advapi32.o \ advapi32.o \
arc4random_stir.o \ arc4random_stir.o \
@ -305,6 +400,7 @@ DLL_OFILES:= \
xsique.o \ xsique.o \
$(EXTRA_OFILES) \ $(EXTRA_OFILES) \
$(MALLOC_OFILES) \ $(MALLOC_OFILES) \
$(MATH_OFILES) \
$(MT_SAFE_OBJECTS) $(MT_SAFE_OBJECTS)
EXCLUDE_STATIC_OFILES:=$(addprefix --exclude=,\ 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 ${CURDIR}/libc.a: ${LIB_NAME} ${CURDIR}/libm.a libpthread.a libutil.a
${speclib} -v ${@F} ${speclib} -v ${@F}
${CURDIR}/libm.a: ${LIB_NAME} $(LIBM) ${CURDIR}/libm.a: ${LIB_NAME} $(LIBM) $(MATH_OFILES)
${speclib} ${@F} ${speclib} ${@F}
libpthread.a: ${LIB_NAME} pthread.o thread.o libpthread.a: ${LIB_NAME} pthread.o thread.o

View File

@ -64,10 +64,10 @@ __getpagesize = getpagesize SIGFE
__getreent NOSIGFE __getreent NOSIGFE
__gnu_basename NOSIGFE __gnu_basename NOSIGFE
__infinity NOSIGFE __infinity NOSIGFE
__isinfd NOSIGFE __isinfd = isinf NOSIGFE
__isinff NOSIGFE __isinff = isinff NOSIGFE
__isnand NOSIGFE __isnand = isnan NOSIGFE
__isnanf NOSIGFE __isnanf = isnanf NOSIGFE
__locale_mb_cur_max NOSIGFE __locale_mb_cur_max NOSIGFE
__main NOSIGFE __main NOSIGFE
__mempcpy = mempcpy NOSIGFE __mempcpy = mempcpy NOSIGFE
@ -169,6 +169,8 @@ acos NOSIGFE
acosf NOSIGFE acosf NOSIGFE
acosh NOSIGFE acosh NOSIGFE
acoshf NOSIGFE acoshf NOSIGFE
acoshl NOSIGFE
acosl NOSIGFE
alarm SIGFE alarm SIGFE
aligned_alloc SIGFE aligned_alloc SIGFE
alphasort NOSIGFE alphasort NOSIGFE
@ -195,14 +197,19 @@ asin NOSIGFE
asinf NOSIGFE asinf NOSIGFE
asinh NOSIGFE asinh NOSIGFE
asinhf NOSIGFE asinhf NOSIGFE
asinhl NOSIGFE
asinl NOSIGFE
asnprintf SIGFE asnprintf SIGFE
asprintf SIGFE asprintf SIGFE
atan NOSIGFE atan NOSIGFE
atan2 NOSIGFE atan2 NOSIGFE
atan2f NOSIGFE atan2f NOSIGFE
atan2l NOSIGFE
atanf NOSIGFE atanf NOSIGFE
atanh NOSIGFE atanh NOSIGFE
atanhf NOSIGFE atanhf NOSIGFE
atanhl NOSIGFE
atanl NOSIGFE
atexit = cygwin_atexit SIGFE atexit = cygwin_atexit SIGFE
atof SIGFE atof SIGFE
atoff SIGFE atoff SIGFE
@ -226,28 +233,40 @@ cacos NOSIGFE
cacosf NOSIGFE cacosf NOSIGFE
cacosh NOSIGFE cacosh NOSIGFE
cacoshf NOSIGFE cacoshf NOSIGFE
cacoshl NOSIGFE
cacosl NOSIGFE
calloc SIGFE calloc SIGFE
canonicalize_file_name SIGFE canonicalize_file_name SIGFE
carg NOSIGFE carg NOSIGFE
cargf NOSIGFE cargf NOSIGFE
cargl NOSIGFE
casin NOSIGFE casin NOSIGFE
casinf NOSIGFE casinf NOSIGFE
casinh NOSIGFE casinh NOSIGFE
casinhf NOSIGFE casinhf NOSIGFE
casinhl NOSIGFE
casinl NOSIGFE
catan NOSIGFE catan NOSIGFE
catanf NOSIGFE catanf NOSIGFE
catanh NOSIGFE catanh NOSIGFE
catanhf NOSIGFE catanhf NOSIGFE
catanhl NOSIGFE
catanl NOSIGFE
cbrt NOSIGFE cbrt NOSIGFE
cbrtf NOSIGFE cbrtf NOSIGFE
cbrtl NOSIGFE
ccos NOSIGFE ccos NOSIGFE
ccosf NOSIGFE ccosf NOSIGFE
ccosh NOSIGFE ccosh NOSIGFE
ccoshf NOSIGFE ccoshf NOSIGFE
ccoshl NOSIGFE
ccosl NOSIGFE
ceil NOSIGFE ceil NOSIGFE
ceilf NOSIGFE ceilf NOSIGFE
ceill NOSIGFE
cexp NOSIGFE cexp NOSIGFE
cexpf NOSIGFE cexpf NOSIGFE
cexpl NOSIGFE
cfgetispeed NOSIGFE cfgetispeed NOSIGFE
cfgetospeed NOSIGFE cfgetospeed NOSIGFE
cfmakeraw NOSIGFE cfmakeraw NOSIGFE
@ -274,24 +293,32 @@ clock_settime SIGFE
clog NOSIGFE clog NOSIGFE
clog10 NOSIGFE clog10 NOSIGFE
clog10f NOSIGFE clog10f NOSIGFE
clog10l NOSIGFE
clogf NOSIGFE clogf NOSIGFE
clogl NOSIGFE
close SIGFE close SIGFE
closedir SIGFE closedir SIGFE
closelog SIGFE closelog SIGFE
confstr NOSIGFE confstr NOSIGFE
conj NOSIGFE conj NOSIGFE
conjf NOSIGFE conjf NOSIGFE
conjl NOSIGFE
connect = cygwin_connect SIGFE connect = cygwin_connect SIGFE
copysign NOSIGFE copysign NOSIGFE
copysignf NOSIGFE copysignf NOSIGFE
copysignl NOSIGFE
cos NOSIGFE cos NOSIGFE
cosf NOSIGFE cosf NOSIGFE
cosh NOSIGFE cosh NOSIGFE
coshf NOSIGFE coshf NOSIGFE
coshl NOSIGFE
cosl NOSIGFE
cpow NOSIGFE cpow NOSIGFE
cpowf NOSIGFE cpowf NOSIGFE
cpowl NOSIGFE
cproj NOSIGFE cproj NOSIGFE
cprojf NOSIGFE cprojf NOSIGFE
cprojl NOSIGFE
creal NOSIGFE creal NOSIGFE
crealf NOSIGFE crealf NOSIGFE
creall NOSIGFE creall NOSIGFE
@ -300,12 +327,17 @@ csin NOSIGFE
csinf NOSIGFE csinf NOSIGFE
csinh NOSIGFE csinh NOSIGFE
csinhf NOSIGFE csinhf NOSIGFE
csinhl NOSIGFE
csinl NOSIGFE
csqrt NOSIGFE csqrt NOSIGFE
csqrtf NOSIGFE csqrtf NOSIGFE
csqrtl NOSIGFE
ctan NOSIGFE ctan NOSIGFE
ctanf NOSIGFE ctanf NOSIGFE
ctanh NOSIGFE ctanh NOSIGFE
ctanhf NOSIGFE ctanhf NOSIGFE
ctanhl NOSIGFE
ctanl NOSIGFE
ctermid SIGFE ctermid SIGFE
ctime SIGFE ctime SIGFE
ctime_r SIGFE ctime_r SIGFE
@ -342,8 +374,9 @@ dn_expand = __dn_expand SIGFE
dn_skipname = __dn_skipname SIGFE dn_skipname = __dn_skipname SIGFE
dprintf SIGFE dprintf SIGFE
drand48 NOSIGFE drand48 NOSIGFE
drem NOSIGFE drem = remainder NOSIGFE
dremf NOSIGFE dremf= remainderf NOSIGFE
dreml= remainderl NOSIGFE
dup SIGFE dup SIGFE
dup2 SIGFE dup2 SIGFE
dup3 SIGFE dup3 SIGFE
@ -370,7 +403,9 @@ erand48 NOSIGFE
erf NOSIGFE erf NOSIGFE
erfc NOSIGFE erfc NOSIGFE
erfcf NOSIGFE erfcf NOSIGFE
erfcl NOSIGFE
erff NOSIGFE erff NOSIGFE
erfl NOSIGFE
err SIGFE err SIGFE
error SIGFE error SIGFE
error_at_line SIGFE error_at_line SIGFE
@ -387,13 +422,18 @@ exit = cygwin_exit SIGFE
exp NOSIGFE exp NOSIGFE
exp10 NOSIGFE exp10 NOSIGFE
exp10f NOSIGFE exp10f NOSIGFE
exp10l NOSIGFE
exp2 NOSIGFE exp2 NOSIGFE
exp2f NOSIGFE exp2f NOSIGFE
exp2l NOSIGFE
expf NOSIGFE expf NOSIGFE
expl NOSIGFE
expm1 NOSIGFE expm1 NOSIGFE
expm1f NOSIGFE expm1f NOSIGFE
expm1l NOSIGFE
fabs NOSIGFE fabs NOSIGFE
fabsf NOSIGFE fabsf NOSIGFE
fabsl NOSIGFE
faccessat SIGFE faccessat SIGFE
facl SIGFE facl SIGFE
fchdir SIGFE fchdir SIGFE
@ -410,6 +450,7 @@ fcvtf SIGFE
fdatasync SIGFE fdatasync SIGFE
fdim NOSIGFE fdim NOSIGFE
fdimf NOSIGFE fdimf NOSIGFE
fdiml NOSIGFE
fdopen SIGFE fdopen SIGFE
fdopendir SIGFE fdopendir SIGFE
feclearexcept NOSIGFE feclearexcept NOSIGFE
@ -459,15 +500,20 @@ flock SIGFE
flockfile SIGFE flockfile SIGFE
floor NOSIGFE floor NOSIGFE
floorf NOSIGFE floorf NOSIGFE
floorl NOSIGFE
fma NOSIGFE fma NOSIGFE
fmaf NOSIGFE fmaf NOSIGFE
fmal NOSIGFE
fmax NOSIGFE fmax NOSIGFE
fmaxf NOSIGFE fmaxf NOSIGFE
fmaxl NOSIGFE
fmemopen SIGFE fmemopen SIGFE
fmin NOSIGFE fmin NOSIGFE
fminf NOSIGFE fminf NOSIGFE
fminl NOSIGFE
fmod NOSIGFE fmod NOSIGFE
fmodf NOSIGFE fmodf NOSIGFE
fmodl NOSIGFE
fnmatch NOSIGFE fnmatch NOSIGFE
fopen SIGFE fopen SIGFE
fopencookie SIGFE fopencookie SIGFE
@ -493,6 +539,7 @@ fremovexattr SIGFE
freopen SIGFE freopen SIGFE
frexp NOSIGFE frexp NOSIGFE
frexpf NOSIGFE frexpf NOSIGFE
frexpl NOSIGFE
fscanf SIGFE fscanf SIGFE
fseek SIGFE fseek SIGFE
fseeko SIGFE fseeko SIGFE
@ -650,6 +697,7 @@ if_nameindex SIGFE
if_nametoindex SIGFE if_nametoindex SIGFE
ilogb NOSIGFE ilogb NOSIGFE
ilogbf NOSIGFE ilogbf NOSIGFE
ilogbl NOSIGFE
imaxabs = llabs NOSIGFE imaxabs = llabs NOSIGFE
imaxdiv = lldiv NOSIGFE imaxdiv = lldiv NOSIGFE
index NOSIGFE index NOSIGFE
@ -680,9 +728,11 @@ isdigit NOSIGFE
isgraph NOSIGFE isgraph NOSIGFE
isinf NOSIGFE isinf NOSIGFE
isinff NOSIGFE isinff NOSIGFE
isinfl NOSIGFE
islower NOSIGFE islower NOSIGFE
isnan NOSIGFE isnan NOSIGFE
isnanf NOSIGFE isnanf NOSIGFE
isnanl NOSIGFE
isprint NOSIGFE isprint NOSIGFE
ispunct NOSIGFE ispunct NOSIGFE
issetugid NOSIGFE issetugid NOSIGFE
@ -717,12 +767,15 @@ lchown SIGFE
lcong48 NOSIGFE lcong48 NOSIGFE
ldexp NOSIGFE ldexp NOSIGFE
ldexpf NOSIGFE ldexpf NOSIGFE
ldexpl NOSIGFE
ldiv NOSIGFE ldiv NOSIGFE
lfind NOSIGFE lfind NOSIGFE
lgamma NOSIGFE lgamma NOSIGFE
lgamma_r NOSIGFE lgamma_r NOSIGFE
lgammaf NOSIGFE lgammaf NOSIGFE
lgammaf_r NOSIGFE lgammaf_r NOSIGFE
lgammal NOSIGFE
lgammal_r NOSIGFE
lgetxattr SIGFE lgetxattr SIGFE
link SIGFE link SIGFE
linkat SIGFE linkat SIGFE
@ -731,8 +784,12 @@ listxattr SIGFE
llabs NOSIGFE llabs NOSIGFE
lldiv NOSIGFE lldiv NOSIGFE
llistxattr SIGFE llistxattr SIGFE
llrint NOSIGFE
llrintf NOSIGFE
llrintl NOSIGFE
llround NOSIGFE llround NOSIGFE
llroundf NOSIGFE llroundf NOSIGFE
llroundl NOSIGFE
localeconv NOSIGFE localeconv NOSIGFE
localtime SIGFE localtime SIGFE
localtime_r SIGFE localtime_r SIGFE
@ -740,13 +797,18 @@ lockf SIGFE
log NOSIGFE log NOSIGFE
log10 NOSIGFE log10 NOSIGFE
log10f NOSIGFE log10f NOSIGFE
log10l NOSIGFE
log1p NOSIGFE log1p NOSIGFE
log1pf NOSIGFE log1pf NOSIGFE
log1pl NOSIGFE
log2 NOSIGFE log2 NOSIGFE
log2f NOSIGFE log2f NOSIGFE
log2l NOSIGFE
logb NOSIGFE logb NOSIGFE
logbf NOSIGFE logbf NOSIGFE
logbl NOSIGFE
logf NOSIGFE logf NOSIGFE
logl NOSIGFE
login SIGFE login SIGFE
login_tty SIGFE login_tty SIGFE
logout SIGFE logout SIGFE
@ -754,8 +816,12 @@ logwtmp SIGFE
longjmp NOSIGFE longjmp NOSIGFE
lrand48 NOSIGFE lrand48 NOSIGFE
lremovexattr SIGFE lremovexattr SIGFE
lrint NOSIGFE
lrintf NOSIGFE
lrintl NOSIGFE
lround NOSIGFE lround NOSIGFE
lroundf NOSIGFE lroundf NOSIGFE
lroundl NOSIGFE
lsearch NOSIGFE lsearch NOSIGFE
lseek SIGFE lseek SIGFE
lsetxattr SIGFE lsetxattr SIGFE
@ -805,6 +871,7 @@ mlock SIGFE
mmap SIGFE mmap SIGFE
modf NOSIGFE modf NOSIGFE
modff NOSIGFE modff NOSIGFE
modfl NOSIGFE
mount SIGFE mount SIGFE
mprotect SIGFE mprotect SIGFE
mq_close SIGFE mq_close SIGFE
@ -830,8 +897,13 @@ nanf NOSIGFE
nanosleep SIGFE nanosleep SIGFE
nearbyint NOSIGFE nearbyint NOSIGFE
nearbyintf NOSIGFE nearbyintf NOSIGFE
nearbyintl NOSIGFE
nextafter NOSIGFE nextafter NOSIGFE
nextafterf NOSIGFE nextafterf NOSIGFE
nextafterl NOSIGFE
nexttoward NOSIGFE
nexttowardf NOSIGFE
nexttowardl NOSIGFE
nftw SIGFE nftw SIGFE
nice SIGFE nice SIGFE
nl_langinfo SIGFE nl_langinfo SIGFE
@ -883,7 +955,9 @@ posix_spawn_file_actions_addopen SIGFE
pow NOSIGFE pow NOSIGFE
pow10 NOSIGFE pow10 NOSIGFE
pow10f NOSIGFE pow10f NOSIGFE
pow10l NOSIGFE
powf NOSIGFE powf NOSIGFE
powl NOSIGFE
ppoll SIGFE ppoll SIGFE
pread SIGFE pread SIGFE
printf SIGFE printf SIGFE
@ -1037,11 +1111,13 @@ regexec SIGFE
regfree SIGFE regfree SIGFE
remainder NOSIGFE remainder NOSIGFE
remainderf NOSIGFE remainderf NOSIGFE
remainderl NOSIGFE
remove SIGFE remove SIGFE
removexattr SIGFE removexattr SIGFE
remque NOSIGFE remque NOSIGFE
remquo NOSIGFE remquo NOSIGFE
remquof NOSIGFE remquof NOSIGFE
remquol NOSIGFE
rename SIGFE rename SIGFE
renameat SIGFE renameat SIGFE
res_close = __res_close SIGFE res_close = __res_close SIGFE
@ -1063,9 +1139,13 @@ rewind SIGFE
rewinddir SIGFE rewinddir SIGFE
rexec = cygwin_rexec SIGFE rexec = cygwin_rexec SIGFE
rindex NOSIGFE rindex NOSIGFE
rint NOSIGFE
rintf NOSIGFE
rintl NOSIGFE
rmdir SIGFE rmdir SIGFE
round NOSIGFE round NOSIGFE
roundf NOSIGFE roundf NOSIGFE
roundl NOSIGFE
rpmatch SIGFE rpmatch SIGFE
rresvport = cygwin_rresvport SIGFE rresvport = cygwin_rresvport SIGFE
rresvport_af = cygwin_rresvport_af SIGFE rresvport_af = cygwin_rresvport_af SIGFE
@ -1073,10 +1153,13 @@ ruserok SIGFE
sbrk SIGFE sbrk SIGFE
scalb NOSIGFE scalb NOSIGFE
scalbf NOSIGFE scalbf NOSIGFE
scalbl NOSIGFE
scalbln NOSIGFE scalbln NOSIGFE
scalblnf NOSIGFE scalblnf NOSIGFE
scalblnl NOSIGFE
scalbn NOSIGFE scalbn NOSIGFE
scalbnf NOSIGFE scalbnf NOSIGFE
scalbnl NOSIGFE
scandir SIGFE scandir SIGFE
scandirat SIGFE scandirat SIGFE
scanf SIGFE scanf SIGFE
@ -1180,9 +1263,12 @@ sigwaitinfo SIGFE
sin NOSIGFE sin NOSIGFE
sincos NOSIGFE sincos NOSIGFE
sincosf NOSIGFE sincosf NOSIGFE
sincosl NOSIGFE
sinf NOSIGFE sinf NOSIGFE
sinh NOSIGFE sinh NOSIGFE
sinhf NOSIGFE sinhf NOSIGFE
sinhl NOSIGFE
sinl NOSIGFE
siprintf SIGFE siprintf SIGFE
sleep SIGFE sleep SIGFE
snprintf SIGFE snprintf SIGFE
@ -1271,6 +1357,8 @@ tan NOSIGFE
tanf NOSIGFE tanf NOSIGFE
tanh NOSIGFE tanh NOSIGFE
tanhf NOSIGFE tanhf NOSIGFE
tanhl NOSIGFE
tanl NOSIGFE
tcdrain SIGFE tcdrain SIGFE
tcflow SIGFE tcflow SIGFE
tcflush SIGFE tcflush SIGFE
@ -1287,6 +1375,7 @@ tempnam SIGFE
tfind NOSIGFE tfind NOSIGFE
tgamma NOSIGFE tgamma NOSIGFE
tgammaf NOSIGFE tgammaf NOSIGFE
tgammal NOSIGFE
time SIGFE time SIGFE
timegm NOSIGFE timegm NOSIGFE
timelocal SIGFE timelocal SIGFE
@ -1307,6 +1396,7 @@ towupper NOSIGFE
trunc NOSIGFE trunc NOSIGFE
truncate SIGFE truncate SIGFE
truncf NOSIGFE truncf NOSIGFE
truncl NOSIGFE
tsearch SIGFE tsearch SIGFE
ttyname SIGFE ttyname SIGFE
ttyname_r SIGFE ttyname_r SIGFE

View File

@ -164,21 +164,21 @@ _f_frexp NOSIGFE
_f_frexpf NOSIGFE _f_frexpf NOSIGFE
_f_ldexp NOSIGFE _f_ldexp NOSIGFE
_f_ldexpf NOSIGFE _f_ldexpf NOSIGFE
_f_llrint NOSIGFE _f_llrint = llrint NOSIGFE
_f_llrintf NOSIGFE _f_llrintf = llrintf NOSIGFE
_f_llrintl NOSIGFE _f_llrintl = llrintl NOSIGFE
_f_log NOSIGFE _f_log NOSIGFE
_f_log10 NOSIGFE _f_log10 NOSIGFE
_f_log10f NOSIGFE _f_log10f NOSIGFE
_f_logf NOSIGFE _f_logf NOSIGFE
_f_lrint NOSIGFE _f_lrint = lrint NOSIGFE
_f_lrintf NOSIGFE _f_lrintf = lrintf NOSIGFE
_f_lrintl NOSIGFE _f_lrintl = lrintl NOSIGFE
_f_pow NOSIGFE _f_pow NOSIGFE
_f_powf NOSIGFE _f_powf NOSIGFE
_f_rint NOSIGFE _f_rint = rint NOSIGFE
_f_rintf NOSIGFE _f_rintf = rintf NOSIGFE
_f_rintl NOSIGFE _f_rintl = rintl NOSIGFE
_f_tan NOSIGFE _f_tan NOSIGFE
_f_tanf NOSIGFE _f_tanf NOSIGFE
_fabs = fabs NOSIGFE _fabs = fabs NOSIGFE
@ -622,19 +622,10 @@ fscanf_r = _fscanf_r SIGFE
get_osfhandle = _get_osfhandle SIGFE get_osfhandle = _get_osfhandle SIGFE
getpwduid NOSIGFE getpwduid NOSIGFE
lacl SIGFE 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_regcomp = regcomp SIGFE
posix_regerror = regerror SIGFE posix_regerror = regerror SIGFE
posix_regexec = regexec SIGFE posix_regexec = regexec SIGFE
posix_regfree = regfree SIGFE posix_regfree = regfree SIGFE
rint = _f_rint NOSIGFE
rintf = _f_rintf NOSIGFE
rintl = _f_rintl NOSIGFE
scanf_r = _scanf_r SIGFE scanf_r = _scanf_r SIGFE
setmode = cygwin_setmode SIGFE setmode = cygwin_setmode SIGFE
setregid32 SIGFE setregid32 SIGFE

View File

@ -478,13 +478,24 @@ details. */
294: Export clog10, clog10f. 294: Export clog10, clog10f.
295: Export POSIX ACL functions. 295: Export POSIX ACL functions.
296: Export __getpagesize. 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, /* Note that we forgot to bump the api for ualarm, strtoll, strtoull,
sigaltstack, sethostname. */ sigaltstack, sethostname. */
#define CYGWIN_VERSION_API_MAJOR 0 #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 /* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible shared memory regions. It is incremented when incompatible

43
winsup/cygwin/math.h Normal file
View File

@ -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_ */

View File

@ -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.
*/

View File

@ -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))));
}

View File

@ -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"

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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"

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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"

View File

@ -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);
}

View File

@ -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"

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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"

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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"

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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"

124
winsup/cygwin/math/ceil.S Normal file
View File

@ -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

120
winsup/cygwin/math/ceilf.S Normal file
View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,719 @@
/**
* 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.
*/
#ifndef _CEPHES_EMATH_H
#define _CEPHES_EMATH_H
/**
* This is a workaround for a gcc bug
*/
#define __restrict__
/* This file is extracted from S L Moshier's ioldoubl.c,
* modified for use in MinGW
*
* Extended precision arithmetic functions for long double I/O.
* This program has been placed in the public domain.
*/
/*
* Revision history:
*
* 5 Jan 84 PDP-11 assembly language version
* 6 Dec 86 C language version
* 30 Aug 88 100 digit version, improved rounding
* 15 May 92 80-bit long double support
*
* Author: S. L. Moshier.
*
* 6 Oct 02 Modified for MinGW by inlining utility routines,
* removing global variables, and splitting out strtold
* from _IO_ldtoa and _IO_ldtostr.
*
* Danny Smith <dannysmith@users.sourceforge.net>
*
*/
/* ieee.c
*
* Extended precision IEEE binary floating point arithmetic routines
*
* Numbers are stored in C language as arrays of 16-bit unsigned
* short integers. The arguments of the routines are pointers to
* the arrays.
*
*
* External e type data structure, simulates Intel 8087 chip
* temporary real format but possibly with a larger significand:
*
* NE-1 significand words (least significant word first,
* most significant bit is normally set)
* exponent (value = EXONE for 1.0,
* top bit is the sign)
*
*
* Internal data structure of a number (a "word" is 16 bits):
*
* ei[0] sign word (0 for positive, 0xffff for negative)
* ei[1] biased __exponent (value = EXONE for the number 1.0)
* ei[2] high guard word (always zero after normalization)
* ei[3]
* to ei[NI-2] significand (NI-4 significand words,
* most significant word first,
* most significant bit is set)
* ei[NI-1] low guard word (0x8000 bit is rounding place)
*
*
*
* Routines for external format numbers
*
* __asctoe64( string, &d ) ASCII string to long double
* __asctoeg( string, e, prec ) ASCII string to specified precision
* __e64toe( &d, e ) IEEE long double precision to e type
* __eadd( a, b, c ) c = b + a
* __eclear(e) e = 0
* __ecmp (a, b) Returns 1 if a > b, 0 if a == b,
* -1 if a < b, -2 if either a or b is a NaN.
* __ediv( a, b, c ) c = b / a
* __efloor( a, b ) truncate to integer, toward -infinity
* __efrexp( a, exp, s ) extract exponent and significand
* __eifrac( e, &l, frac ) e to long integer and e type fraction
* __euifrac( e, &l, frac ) e to unsigned long integer and e type fraction
* __einfin( e ) set e to infinity, leaving its sign alone
* __eldexp( a, n, b ) multiply by 2**n
* __emov( a, b ) b = a
* __emul( a, b, c ) c = b * a
* __eneg(e) e = -e
* __eround( a, b ) b = nearest integer value to a
* __esub( a, b, c ) c = b - a
* __e24toasc( &f, str, n ) single to ASCII string, n digits after decimal
* __e53toasc( &d, str, n ) double to ASCII string, n digits after decimal
* __e64toasc( &d, str, n ) long double to ASCII string
* __etoasc( e, str, n ) e to ASCII string, n digits after decimal
* __etoe24( e, &f ) convert e type to IEEE single precision
* __etoe53( e, &d ) convert e type to IEEE double precision
* __etoe64( e, &d ) convert e type to IEEE long double precision
* __eisneg( e ) 1 if sign bit of e != 0, else 0
* __eisinf( e ) 1 if e has maximum exponent (non-IEEE)
* or is infinite (IEEE)
* __eisnan( e ) 1 if e is a NaN
* __esqrt( a, b ) b = square root of a
*
*
* Routines for internal format numbers
*
* __eaddm( ai, bi ) add significands, bi = bi + ai
* __ecleaz(ei) ei = 0
* __ecleazs(ei) set ei = 0 but leave its sign alone
* __ecmpm( ai, bi ) compare significands, return 1, 0, or -1
* __edivm( ai, bi ) divide significands, bi = bi / ai
* __emdnorm(ai,l,s,exp) normalize and round off
* __emovi( a, ai ) convert external a to internal ai
* __emovo( ai, a ) convert internal ai to external a
* __emovz( ai, bi ) bi = ai, low guard word of bi = 0
* __emulm( ai, bi ) multiply significands, bi = bi * ai
* __enormlz(ei) left-justify the significand
* __eshdn1( ai ) shift significand and guards down 1 bit
* __eshdn8( ai ) shift down 8 bits
* __eshdn6( ai ) shift down 16 bits
* __eshift( ai, n ) shift ai n bits up (or down if n < 0)
* __eshup1( ai ) shift significand and guards up 1 bit
* __eshup8( ai ) shift up 8 bits
* __eshup6( ai ) shift up 16 bits
* __esubm( ai, bi ) subtract significands, bi = bi - ai
*
*
* The result is always normalized and rounded to NI-4 word precision
* after each arithmetic operation.
*
* Exception flags are NOT fully supported.
*
* Define INFINITY in mconf.h for support of infinity; otherwise a
* saturation arithmetic is implemented.
*
* Define NANS for support of Not-a-Number items; otherwise the
* arithmetic will never produce a NaN output, and might be confused
* by a NaN input.
* If NaN's are supported, the output of ecmp(a,b) is -2 if
* either a or b is a NaN. This means asking if(ecmp(a,b) < 0)
* may not be legitimate. Use if(ecmp(a,b) == -1) for less-than
* if in doubt.
* Signaling NaN's are NOT supported; they are treated the same
* as quiet NaN's.
*
* Denormals are always supported here where appropriate (e.g., not
* for conversion to DEC numbers).
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <locale.h>
#include <ctype.h>
#undef alloca
#define alloca __builtin_alloca
/* Don't build non-ANSI _IO_ldtoa. It is not thread safe. */
#ifndef USE_LDTOA
#define USE_LDTOA 0
#endif
/* Number of 16 bit words in external x type format */
#define NE 6
/* Number of 16 bit words in internal format */
#define NI (NE+3)
/* Array offset to exponent */
#define E 1
/* Array offset to high guard word */
#define M 2
/* Number of bits of precision */
#define NBITS ((NI-4)*16)
/* Maximum number of decimal digits in ASCII conversion
* = NBITS*log10(2)
*/
#define NDEC (NBITS*8/27)
/* The exponent of 1.0 */
#define EXONE (0x3fff)
#define mtherr(x,y)
extern long double strtold (const char * __restrict__ s, char ** __restrict__ se);
extern int __asctoe64(const char * __restrict__ ss,
short unsigned int * __restrict__ y);
extern void __emul(const short unsigned int * a,
const short unsigned int * b,
short unsigned int * c);
extern int __ecmp(const short unsigned int * __restrict__ a,
const short unsigned int * __restrict__ b);
extern int __enormlz(short unsigned int *x);
extern int __eshift(short unsigned int *x, int sc);
extern void __eaddm(const short unsigned int * __restrict__ x,
short unsigned int * __restrict__ y);
extern void __esubm(const short unsigned int * __restrict__ x,
short unsigned int * __restrict__ y);
extern void __emdnorm(short unsigned int *s, int lost, int subflg,
int exp, int rcntrl, const int rndprc);
extern void __toe64(short unsigned int * __restrict__ a,
short unsigned int * __restrict__ b);
extern int __edivm(short unsigned int * __restrict__ den,
short unsigned int * __restrict__ num);
extern int __emulm(const short unsigned int * __restrict__ a,
short unsigned int * __restrict__ b);
extern void __emovi(const short unsigned int * __restrict__ a,
short unsigned int * __restrict__ b);
extern void __emovo(const short unsigned int * __restrict__ a,
short unsigned int * __restrict__ b);
#if USE_LDTOA
extern char * _IO_ldtoa(long double, int, int, int *, int *, char **);
extern void _IO_ldtostr(long double *x, char *string, int ndigs,
int flags, char fmt);
extern void __eiremain(short unsigned int * __restrict__ den,
short unsigned int *__restrict__ num,
short unsigned int *__restrict__ equot);
extern void __efloor(short unsigned int *x, short unsigned int *y);
extern void __eadd1(const short unsigned int * __restrict__ a,
const short unsigned int * __restrict__ b,
short unsigned int * __restrict__ c,
int subflg);
extern void __esub(const short unsigned int *a, const short unsigned int *b,
short unsigned int *c);
extern void __ediv(const short unsigned int *a, const short unsigned int *b,
short unsigned int *c);
extern void __e64toe(short unsigned int *pe, short unsigned int *y);
#endif
static __inline__ int __eisneg(const short unsigned int *x);
static __inline__ int __eisinf(const short unsigned int *x);
static __inline__ int __eisnan(const short unsigned int *x);
static __inline__ int __eiszero(const short unsigned int *a);
static __inline__ void __emovz(register const short unsigned int * __restrict__ a,
register short unsigned int * __restrict__ b);
static __inline__ void __eclear(register short unsigned int *x);
static __inline__ void __ecleaz(register short unsigned int *xi);
static __inline__ void __ecleazs(register short unsigned int *xi);
static __inline__ int __eiisinf(const short unsigned int *x);
static __inline__ int __eiisnan(const short unsigned int *x);
static __inline__ int __eiiszero(const short unsigned int *x);
static __inline__ void __enan_64(short unsigned int *nanptr);
static __inline__ void __enan_NBITS (short unsigned int *nanptr);
static __inline__ void __enan_NI16 (short unsigned int *nanptr);
static __inline__ void __einfin(register short unsigned int *x);
static __inline__ void __eneg(short unsigned int *x);
static __inline__ void __eshup1(register short unsigned int *x);
static __inline__ void __eshup8(register short unsigned int *x);
static __inline__ void __eshup6(register short unsigned int *x);
static __inline__ void __eshdn1(register short unsigned int *x);
static __inline__ void __eshdn8(register short unsigned int *x);
static __inline__ void __eshdn6(register short unsigned int *x);
/* Intel IEEE, low order words come first:
*/
#define IBMPC 1
/* Define 1 for ANSI C atan2() function
* See atan.c and clog.c.
*/
#define ANSIC 1
/*define VOLATILE volatile*/
#define VOLATILE
/* For 12-byte long doubles on an i386, pad a 16-bit short 0
* to the end of real constants initialized by integer arrays.
*
* #define XPD 0,
*
* Otherwise, the type is 10 bytes long and XPD should be
* defined blank.
*
* #define XPD
*/
#define XPD 0,
/* #define XPD */
#define NANS
/* NaN's require infinity support. */
#ifdef NANS
#ifndef INFINITY
#define INFINITY
#endif
#endif
/* This handles 64-bit long ints. */
#define LONGBITS (8 * sizeof(long))
#define NTEN 12
#define MAXP 4096
/*
; Clear out entire external format number.
;
; unsigned short x[];
; eclear( x );
*/
static __inline__ void __eclear(register short unsigned int *x)
{
memset(x, 0, NE * sizeof(unsigned short));
}
/* Move external format number from a to b.
*
* emov( a, b );
*/
static __inline__ void __emov(register const short unsigned int * __restrict__ a,
register short unsigned int * __restrict__ b)
{
memcpy(b, a, NE * sizeof(unsigned short));
}
/*
; Negate external format number
;
; unsigned short x[NE];
; eneg( x );
*/
static __inline__ void __eneg(short unsigned int *x)
{
#ifdef NANS
if (__eisnan(x))
return;
#endif
x[NE-1] ^= 0x8000; /* Toggle the sign bit */
}
/* Return 1 if external format number is negative,
* else return zero.
*/
static __inline__ int __eisneg(const short unsigned int *x)
{
#ifdef NANS
if (__eisnan(x))
return (0);
#endif
if (x[NE-1] & 0x8000)
return (1);
else
return (0);
}
/* Return 1 if external format number has maximum possible exponent,
* else return zero.
*/
static __inline__ int __eisinf(const short unsigned int *x)
{
if ((x[NE - 1] & 0x7fff) == 0x7fff)
{
#ifdef NANS
if (__eisnan(x))
return (0);
#endif
return (1);
}
else
return (0);
}
/* Check if e-type number is not a number.
*/
static __inline__ int __eisnan(const short unsigned int *x)
{
#ifdef NANS
int i;
/* NaN has maximum __exponent */
if ((x[NE - 1] & 0x7fff) == 0x7fff)
/* ... and non-zero significand field. */
for (i = 0; i < NE - 1; i++)
{
if (*x++ != 0)
return (1);
}
#endif
return (0);
}
/*
; Fill __entire number, including __exponent and significand, with
; largest possible number. These programs implement a saturation
; value that is an ordinary, legal number. A special value
; "infinity" may also be implemented; this would require tests
; for that value and implementation of special rules for arithmetic
; operations involving inifinity.
*/
static __inline__ void __einfin(register short unsigned int *x)
{
register int i;
#ifdef INFINITY
for (i = 0; i < NE - 1; i++)
*x++ = 0;
*x |= 32767;
#else
for (i = 0; i < NE - 1; i++)
*x++ = 0xffff;
*x |= 32766;
*(x - 5) = 0;
#endif
}
/* Clear out internal format number.
*/
static __inline__ void __ecleaz(register short unsigned int *xi)
{
memset(xi, 0, NI * sizeof(unsigned short));
}
/* same, but don't touch the sign. */
static __inline__ void __ecleazs(register short unsigned int *xi)
{
++xi;
memset(xi, 0, (NI-1) * sizeof(unsigned short));
}
/* Move internal format number from a to b.
*/
static __inline__ void __emovz(register const short unsigned int * __restrict__ a,
register short unsigned int * __restrict__ b)
{
memcpy(b, a, (NI-1) * sizeof(unsigned short));
b[NI - 1] = 0;
}
/* Return nonzero if internal format number is a NaN.
*/
static __inline__ int __eiisnan (const short unsigned int *x)
{
int i;
if ((x[E] & 0x7fff) == 0x7fff)
{
for (i = M + 1; i < NI; i++ )
{
if (x[i] != 0)
return (1);
}
}
return (0);
}
/* Return nonzero if external format number is zero. */
static __inline__ int
__eiszero(const short unsigned int * a)
{
union {
long double ld;
unsigned short sh[8];
} av;
av.ld = 0.0;
memcpy (av.sh, a, 12);
if (av.ld == 0.0)
return (1);
return (0);
}
/* Return nonzero if internal format number is zero. */
static __inline__ int
__eiiszero(const short unsigned int * ai)
{
int i;
/* skip the sign word */
for (i = 1; i < NI - 1; i++ )
{
if (ai[i] != 0)
return (0);
}
return (1);
}
/* Return nonzero if internal format number is infinite. */
static __inline__ int
__eiisinf (const unsigned short *x)
{
#ifdef NANS
if (__eiisnan (x))
return (0);
#endif
if ((x[E] & 0x7fff) == 0x7fff)
return (1);
return (0);
}
/*
; Compare significands of numbers in internal format.
; Guard words are included in the comparison.
;
; unsigned short a[NI], b[NI];
; cmpm( a, b );
;
; for the significands:
; returns +1 if a > b
; 0 if a == b
; -1 if a < b
*/
static __inline__ int __ecmpm(register const short unsigned int * __restrict__ a,
register const short unsigned int * __restrict__ b)
{
int i;
a += M; /* skip up to significand area */
b += M;
for (i = M; i < NI; i++)
{
if( *a++ != *b++ )
goto difrnt;
}
return(0);
difrnt:
if ( *(--a) > *(--b) )
return (1);
else
return (-1);
}
/*
; Shift significand down by 1 bit
*/
static __inline__ void __eshdn1(register short unsigned int *x)
{
register unsigned short bits;
int i;
x += M; /* point to significand area */
bits = 0;
for (i = M; i < NI; i++ )
{
if (*x & 1)
bits |= 1;
*x >>= 1;
if (bits & 2)
*x |= 0x8000;
bits <<= 1;
++x;
}
}
/*
; Shift significand up by 1 bit
*/
static __inline__ void __eshup1(register short unsigned int *x)
{
register unsigned short bits;
int i;
x += NI-1;
bits = 0;
for (i = M; i < NI; i++)
{
if (*x & 0x8000)
bits |= 1;
*x <<= 1;
if (bits & 2)
*x |= 1;
bits <<= 1;
--x;
}
}
/*
; Shift significand down by 8 bits
*/
static __inline__ void __eshdn8(register short unsigned int *x)
{
register unsigned short newbyt, oldbyt;
int i;
x += M;
oldbyt = 0;
for (i = M; i < NI; i++)
{
newbyt = *x << 8;
*x >>= 8;
*x |= oldbyt;
oldbyt = newbyt;
++x;
}
}
/*
; Shift significand up by 8 bits
*/
static __inline__ void __eshup8(register short unsigned int *x)
{
int i;
register unsigned short newbyt, oldbyt;
x += NI - 1;
oldbyt = 0;
for (i = M; i < NI; i++)
{
newbyt = *x >> 8;
*x <<= 8;
*x |= oldbyt;
oldbyt = newbyt;
--x;
}
}
/*
; Shift significand up by 16 bits
*/
static __inline__ void __eshup6(register short unsigned int *x)
{
int i;
register unsigned short *p;
p = x + M;
x += M + 1;
for (i = M; i < NI - 1; i++)
*p++ = *x++;
*p = 0;
}
/*
; Shift significand down by 16 bits
*/
static __inline__ void __eshdn6(register short unsigned int *x)
{
int i;
register unsigned short *p;
x += NI - 1;
p = x + 1;
for (i = M; i < NI - 1; i++)
*(--p) = *(--x);
*(--p) = 0;
}
/*
; Add significands
; x + y replaces y
*/
static __inline__ void __enan_64(unsigned short* nanptr)
{
int i;
for (i = 0; i < 3; i++)
*nanptr++ = 0;
*nanptr++ = 0xc000;
*nanptr++ = 0x7fff;
*nanptr = 0;
return;
}
static __inline__ void __enan_NBITS(unsigned short* nanptr)
{
int i;
for (i = 0; i < NE - 2; i++)
*nanptr++ = 0;
*nanptr++ = 0xc000;
*nanptr = 0x7fff;
return;
}
static __inline__ void __enan_NI16(unsigned short* nanptr)
{
int i;
*nanptr++ = 0;
*nanptr++ = 0x7fff;
*nanptr++ = 0;
*nanptr++ = 0xc000;
for (i = 4; i < NI; i++)
*nanptr++ = 0;
return;
}
#endif /* _CEPHES_EMATH_H */

View File

@ -0,0 +1,417 @@
#include <math.h>
#include <errno.h>
#define IBMPC 1
#define ANSIPROT 1
#define MINUSZERO 1
#define INFINITIES 1
#define NANS 1
#define DENORMAL 1
#define VOLATILE
#define mtherr(fname, code)
#define XPD 0,
#ifdef __x86_64__
#define XPD_SHORT 0, 0,
#define XPD_LONG 0,
#else
#define XPD_SHORT
#define XPD_LONG
#endif
#if UNK
typedef union uLD { long double ld; unsigned short sh[8]; long lo[4]; } uLD;
typedef union uD { double d; unsigned short sh[4]; } uD;
#elif IBMPC
typedef union uLD { unsigned short sh[8]; long double ld; long lo[4]; } uLD;
typedef union uD { unsigned short sh[4]; double d; } uD;
#elif MIEEE
typedef union uLD { long lo[4]; long double ld; unsigned short sh[8]; } uLD;
typedef union uD { unsigned short sh[4]; double d; } uD;
#else
#error Unknown uLD/uD type definition
#endif
#define _CEPHES_USE_ERRNO
#ifdef _CEPHES_USE_ERRNO
#define _SET_ERRNO(x) errno = (x)
#else
#define _SET_ERRNO(x)
#endif
/* constants used by cephes functions */
/* double */
#define MAXNUM 1.7976931348623158E308
#define MAXLOG 7.09782712893383996843E2
#define MINLOG -7.08396418532264106224E2
#define LOGE2 6.93147180559945309417E-1
#define LOG2E 1.44269504088896340736
#define PI 3.14159265358979323846
#define PIO2 1.57079632679489661923
#define PIO4 7.85398163397448309616E-1
#define NEGZERO (-0.0)
#undef NAN
#undef INFINITY
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2))
#define INFINITY __builtin_huge_val()
#define NAN __builtin_nan("")
#else
extern double __INF;
#define INFINITY (__INF)
extern double __QNAN;
#define NAN (__QNAN)
#endif
/*long double*/
#if defined(__arm__) || defined(_ARM_)
#define MAXNUML 1.7976931348623158E308
#define MAXLOGL 7.09782712893383996843E2
#define MINLOGL -7.08396418532264106224E2
#define LOGE2L 6.93147180559945309417E-1
#define LOG2EL 1.44269504088896340736
#define PIL 3.14159265358979323846
#define PIO2L 1.57079632679489661923
#define PIO4L 7.85398163397448309616E-1
#else
#define MAXNUML 1.189731495357231765021263853E4932L
#define MAXLOGL 1.1356523406294143949492E4L
#define MINLOGL -1.13994985314888605586758E4L
#define LOGE2L 6.9314718055994530941723E-1L
#define LOG2EL 1.4426950408889634073599E0L
#define PIL 3.1415926535897932384626L
#define PIO2L 1.5707963267948966192313L
#define PIO4L 7.8539816339744830961566E-1L
#endif /* defined(__arm__) || defined(_ARM_) */
#define isfinitel isfinite
#define isinfl isinf
#define isnanl isnan
#define signbitl signbit
#define NEGZEROL (-0.0L)
#undef NANL
#undef INFINITYL
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2))
#define INFINITYL __builtin_huge_vall()
#define NANL __builtin_nanl("")
#else
extern long double __INFL;
#define INFINITYL (__INFL)
extern long double __QNANL;
#define NANL (__QNANL)
#endif
/* float */
#define MAXNUMF 3.4028234663852885981170418348451692544e38F
#define MAXLOGF 88.72283905206835F
#define MINLOGF -103.278929903431851103F /* log(2^-149) */
#define LOG2EF 1.44269504088896341F
#define LOGE2F 0.693147180559945309F
#define PIF 3.141592653589793238F
#define PIO2F 1.5707963267948966192F
#define PIO4F 0.7853981633974483096F
#define isfinitef isfinite
#define isinff isinf
#define isnanf isnan
#define signbitf signbit
#define NEGZEROF (-0.0F)
#undef NANF
#undef INFINITYF
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2))
#define INFINITYF __builtin_huge_valf()
#define NANF __builtin_nanf("")
#else
extern float __INFF;
#define INFINITYF (__INFF)
extern float __QNANF;
#define NANF (__QNANF)
#endif
/* double */
/*
Cephes Math Library Release 2.2: July, 1992
Copyright 1984, 1987, 1988, 1992 by Stephen L. Moshier
Direct inquiries to 30 Frost Street, Cambridge, MA 02140
*/
/* polevl.c
* p1evl.c
*
* Evaluate polynomial
*
*
*
* SYNOPSIS:
*
* int N;
* double x, y, coef[N+1], polevl[];
*
* y = polevl( x, coef, N );
*
*
*
* DESCRIPTION:
*
* Evaluates polynomial of degree N:
*
* 2 N
* y = C + C x + C x +...+ C x
* 0 1 2 N
*
* Coefficients are stored in reverse order:
*
* coef[0] = C , ..., coef[N] = C .
* N 0
*
* The function p1evl() assumes that coef[N] = 1.0 and is
* omitted from the array. Its calling arguments are
* otherwise the same as polevl().
*
*
* SPEED:
*
* In the interest of speed, there are no checks for out
* of bounds arithmetic. This routine is used by most of
* the functions in the library. Depending on available
* equipment features, the user may wish to rewrite the
* program in microcode or assembly language.
*
*/
/* Polynomial evaluator:
* P[0] x^n + P[1] x^(n-1) + ... + P[n]
*/
static __inline__ double polevl(double x, const uD *p, int n)
{
register double y;
y = p->d;
p++;
do
{
y = y * x + p->d;
p++;
}
while (--n);
return (y);
}
/* Polynomial evaluator:
* x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n]
*/
static __inline__ double p1evl(double x, const uD *p, int n)
{
register double y;
n -= 1;
y = x + p->d; p++;
do
{
y = y * x + p->d; p++;
}
while (--n);
return (y);
}
/* long double */
/*
Cephes Math Library Release 2.2: July, 1992
Copyright 1984, 1987, 1988, 1992 by Stephen L. Moshier
Direct inquiries to 30 Frost Street, Cambridge, MA 02140
*/
/* polevll.c
* p1evll.c
*
* Evaluate polynomial
*
*
*
* SYNOPSIS:
*
* int N;
* long double x, y, coef[N+1], polevl[];
*
* y = polevll( x, coef, N );
*
*
*
* DESCRIPTION:
*
* Evaluates polynomial of degree N:
*
* 2 N
* y = C + C x + C x +...+ C x
* 0 1 2 N
*
* Coefficients are stored in reverse order:
*
* coef[0] = C , ..., coef[N] = C .
* N 0
*
* The function p1evll() assumes that coef[N] = 1.0 and is
* omitted from the array. Its calling arguments are
* otherwise the same as polevll().
*
*
* SPEED:
*
* In the interest of speed, there are no checks for out
* of bounds arithmetic. This routine is used by most of
* the functions in the library. Depending on available
* equipment features, the user may wish to rewrite the
* program in microcode or assembly language.
*
*/
/* Polynomial evaluator:
* P[0] x^n + P[1] x^(n-1) + ... + P[n]
*/
static __inline__ long double polevll(long double x, const uLD *p, int n)
{
register long double y;
y = p->ld;
p++;
do
{
y = y * x + p->ld;
p++;
}
while (--n);
return y;
}
/* Polynomial evaluator:
* x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n]
*/
static __inline__ long double p1evll(long double x, const uLD *p, int n)
{
register long double y;
n -= 1;
y = x + p->ld;
p++;
do
{
y = y * x + p->ld;
p++;
}
while (--n);
return (y);
}
/* Float version */
/* polevlf.c
* p1evlf.c
*
* Evaluate polynomial
*
*
*
* SYNOPSIS:
*
* int N;
* float x, y, coef[N+1], polevlf[];
*
* y = polevlf( x, coef, N );
*
*
*
* DESCRIPTION:
*
* Evaluates polynomial of degree N:
*
* 2 N
* y = C + C x + C x +...+ C x
* 0 1 2 N
*
* Coefficients are stored in reverse order:
*
* coef[0] = C , ..., coef[N] = C .
* N 0
*
* The function p1evl() assumes that coef[N] = 1.0 and is
* omitted from the array. Its calling arguments are
* otherwise the same as polevl().
*
*
* SPEED:
*
* In the interest of speed, there are no checks for out
* of bounds arithmetic. This routine is used by most of
* the functions in the library. Depending on available
* equipment features, the user may wish to rewrite the
* program in microcode or assembly language.
*
*/
/*
Cephes Math Library Release 2.1: December, 1988
Copyright 1984, 1987, 1988 by Stephen L. Moshier
Direct inquiries to 30 Frost Street, Cambridge, MA 02140
*/
static __inline__ float polevlf(float x, const float* coef, int N)
{
float ans;
float *p;
int i;
p = (float*)coef;
ans = *p++;
/*
for (i = 0; i < N; i++)
ans = ans * x + *p++;
*/
i = N;
do
ans = ans * x + *p++;
while (--i);
return (ans);
}
/* p1evl() */
/* N
* Evaluate polynomial when coefficient of x is 1.0.
* Otherwise same as polevl.
*/
static __inline__ float p1evlf(float x, const float *coef, int N)
{
float ans;
float *p;
int i;
p = (float*)coef;
ans = x + *p++;
i = N - 1;
do
ans = ans * x + *p++;
while (--i);
return (ans);
}

View File

@ -0,0 +1,111 @@
/*
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(cexp) (__FLT_TYPE __complex__ z)
{
__complex__ __FLT_TYPE ret;
__FLT_TYPE s_x, c_x, exp_val, v;
int r_class = fpclassify (__real__ z);
int i_class = fpclassify (__imag__ z);
if (r_class == FP_INFINITE)
{
if (i_class != FP_NAN && i_class != FP_INFINITE)
{
v = signbit (__real__ z) ? __FLT_CST(0.0) : __FLT_HUGE_VAL;
if (i_class == FP_ZERO)
{
__real__ ret = v;
__imag__ ret = __imag__ z;
return ret;
}
__FLT_ABI(sincos) (__imag__ z, &s_x, &c_x);
__real__ ret = __FLT_ABI(copysign) (v, c_x);
__imag__ ret = __FLT_ABI(copysign) (v, s_x);
return ret;
}
if (signbit (__real__ z) == 0)
{
__real__ ret = __FLT_HUGE_VAL;
__imag__ ret = __FLT_NAN;
}
else
{
__real__ ret = __FLT_CST(0.0);
__imag__ ret = __FLT_ABI(copysign) (__FLT_CST(0.0), __imag__ z);
}
return ret;
}
if (r_class == FP_NAN || i_class == FP_NAN || i_class == FP_INFINITE)
{
__real__ ret = __FLT_NAN;
if (i_class == FP_ZERO)
__imag__ ret = __FLT_ABI(copysign) (__FLT_CST(0.0), __imag__ z);
else
__imag__ ret = __FLT_NAN;
return ret;
}
exp_val = __FLT_ABI(exp) (__real__ z);
__FLT_ABI(sincos) (__imag__ z, &s_x, &c_x);
if (isfinite (exp_val))
{
__real__ ret = exp_val * c_x;
__imag__ ret = exp_val * s_x;
}
else
{
__real__ ret = __FLT_ABI(copysign) (exp_val, c_x);
__imag__ ret = __FLT_ABI(copysign) (exp_val, s_x);
}
return ret;
}

View File

@ -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 "cexp.def.h"

View File

@ -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(cimag) (__FLT_TYPE __complex z)
{
return __imag__ z;
}

View File

@ -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 "cimag.def.h"

View File

@ -0,0 +1,71 @@
/*
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(clog) (__FLT_TYPE __complex__ z)
{
__complex__ __FLT_TYPE ret;
int r_class = fpclassify (__real__ z);
int i_class = fpclassify (__imag__ z);
if (r_class == FP_ZERO && i_class == FP_ZERO)
{
__imag__ ret = signbit (__real__ z) ? __FLT_PI : __FLT_CST(0.0);
__imag__ ret = __FLT_ABI(copysign) (__imag__ ret, __imag__ z);
__real__ ret = -__FLT_CST(1.0) / __FLT_ABI(fabs) (__real__ z);
return ret;
}
if (r_class == FP_NAN || i_class == FP_NAN)
{
__imag__ ret = __FLT_NAN;
__real__ ret = ((r_class == FP_INFINITE || i_class == FP_INFINITE) ? __FLT_HUGE_VAL : __FLT_NAN);
return ret;
}
__real__ ret = __FLT_ABI(log) (__FLT_ABI(hypot) (__real__ z, __imag__ z));
__imag__ ret = __FLT_ABI(atan2) (__imag__ z, __real__ z);
return ret;
}

View File

@ -0,0 +1,71 @@
/*
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(clog10) (__FLT_TYPE __complex__ z)
{
__complex__ __FLT_TYPE ret;
int r_class = fpclassify (__real__ z);
int i_class = fpclassify (__imag__ z);
if (r_class == FP_ZERO && i_class == FP_ZERO)
{
__imag__ ret = signbit (__real__ z) ? __FLT_PI : __FLT_CST(0.0);
__imag__ ret = __FLT_ABI(copysign) (__imag__ ret, __imag__ z);
__real__ ret = -__FLT_CST(1.0) / __FLT_ABI(fabs) (__real__ z);
return ret;
}
if (r_class == FP_NAN || i_class == FP_NAN)
{
__imag__ ret = __FLT_NAN;
__real__ ret = ((r_class == FP_INFINITE || i_class == FP_INFINITE) ? __FLT_HUGE_VAL : __FLT_NAN);
return ret;
}
__real__ ret = __FLT_ABI(log10) (__FLT_ABI(hypot) (__real__ z, __imag__ z));
__imag__ ret = __FLT_LOG10E * __FLT_ABI(atan2) (__imag__ z, __real__ z);
return ret;
}

View File

@ -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 "clog10.def.h"

View File

@ -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 "clog.def.h"

View File

@ -0,0 +1,153 @@
/*
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.
*/
#ifdef __CYGWIN__
/* Disable __IMPORT when defining __fdlib_version. */
#define _COMPILING_NEWLIB
#define _GNU_SOURCE
#endif
#include <math.h>
#include <complex.h>
/* Define some PI constants for long double, as they are not defined in math.h */
#ifndef M_PI_4l
#define M_PI_4l 0.7853981633974483096156608458198757L
#define M_PI_2l 1.5707963267948966192313216916397514L
#define M_PIl 3.1415926535897932384626433832795029L
#endif
/* NAN builtins for gcc, as they are not part of math.h */
#ifndef NANF
#define NANF __builtin_nanf ("")
#endif
#ifndef NANL
#define NANL __builtin_nanl ("")
#endif
/* Some more helpers. */
#define M_PI_3_4 (M_PI - M_PI_4)
#define M_PI_3_4l (M_PIl - M_PI_4l)
#if defined(_NEW_COMPLEX_FLOAT)
# define __FLT_TYPE float
# define __FLT_ABI(N) N##f
# define __FLT_CST(N) N##F
# define __FLT_EPSILON __FLT_EPSILON__
# define __FLT_NAN NANF
# define __FLT_HUGE_VAL HUGE_VALF
# define __FLT_PI M_PI
# define __FLT_PI_2 M_PI_2
# define __FLT_PI_4 M_PI_4
# define __FLT_PI_3_4 M_PI_3_4
# define __FLT_MAXLOG 88.72283905206835F
# define __FLT_MINLOG -103.278929903431851103F
# define __FLT_LOGE2 0.693147180559945309F
# define __FLT_LOG10E 0.434294481903251828F
# define __FLT_REPORT(NAME) NAME "f"
#elif defined(_NEW_COMPLEX_DOUBLE)
# define __FLT_TYPE double
# define __FLT_ABI(N) N
# define __FLT_EPSILON __DBL_EPSILON__
# define __FLT_CST(N) N
# define __FLT_NAN NAN
# define __FLT_HUGE_VAL HUGE_VAL
# define __FLT_PI M_PI
# define __FLT_PI_2 M_PI_2
# define __FLT_PI_4 M_PI_4
# define __FLT_PI_3_4 M_PI_3_4
# define __FLT_MAXLOG 7.09782712893383996843E2
# define __FLT_MINLOG -7.45133219101941108420E2
# define __FLT_LOGE2 6.93147180559945309417E-1
# define __FLT_LOG10E 4.34294481903251827651E-1
# define __FLT_REPORT(NAME) NAME
#elif defined(_NEW_COMPLEX_LDOUBLE)
# define __FLT_TYPE long double
# define __FLT_ABI(N) N##l
# define __FLT_CST(N) N##L
# define __FLT_EPSILON __LDBL_EPSILON__
# define __FLT_NAN NANL
# define __FLT_HUGE_VAL HUGE_VALL
# define __FLT_PI M_PIl
# define __FLT_PI_2 M_PI_2l
# define __FLT_PI_4 M_PI_4l
# define __FLT_PI_3_4 M_PI_3_4l
# define __FLT_MAXLOG 1.1356523406294143949492E4L
# define __FLT_MINLOG -1.1355137111933024058873E4L
# define __FLT_LOGE2 6.9314718055994530941723E-1L
# define __FLT_LOG10E 4.3429448190325182765113E-1L
# define __FLT_REPORT(NAME) NAME "l"
#else
# error "Unknown complex number type"
#endif
#define __FLT_RPT_DOMAIN(NAME, ARG1, ARG2, RSLT) \
errno = EDOM, \
__mingw_raise_matherr (_DOMAIN, __FLT_REPORT(NAME), (double) (ARG1), \
(double) (ARG2), (double) (RSLT))
#define __FLT_RPT_ERANGE(NAME, ARG1, ARG2, RSLT, OVL) \
errno = ERANGE, \
__mingw_raise_matherr (((OVL) ? _OVERFLOW : _UNDERFLOW), \
__FLT_REPORT(NAME), (double) (ARG1), \
(double) (ARG2), (double) (RSLT))
#ifdef __CYGWIN__
inline void __attribute__ ((always_inline))
__mingw_raise_matherr (int typ, const char *name, double a1, double a2,
double rslt)
{
if (_LIB_VERSION != _POSIX_)
{
struct exception ex;
ex.type = typ;
ex.name = (char*)name;
ex.arg1 = a1;
ex.arg2 = a2;
ex.retval = rslt;
matherr(&ex);
}
}
#define _DOMAIN DOMAIN
#define _OVERFLOW OVERFLOW
#define _UNDERFLOW UNDERFLOW
#endif

View File

@ -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 __complex__ __cdecl
__FLT_ABI(conj) (__FLT_TYPE __complex__ z)
{
return ~z;
}

View File

@ -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 "conj.def.h"

View File

@ -0,0 +1,56 @@
/**
* 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>.
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
* Public domain.
*/
#include <_mingw_mac.h>
.file "copysignl.S"
.text
#ifdef __x86_64__
.align 8
#else
.align 4
#endif
.globl __MINGW_USYMBOL(copysignl)
.def __MINGW_USYMBOL(copysignl); .scl 2; .type 32; .endef
__MINGW_USYMBOL(copysignl):
#if defined(_AMD64_) || defined(__x86_64__)
movq (%rdx), %rax
movq %rax, (%rcx)
movq 8(%rdx), %rax
movq 8(%r8), %rdx
andq $0x777f, %rax
andq $0x8000, %rdx
orq %rdx, %rax
movq %rax, 8(%rcx)
movq %rcx, %rax
ret
#elif defined(_ARM_) || defined(__arm__)
fcmpzd d1
fmstat
bmi 1f /* jump if d1 is negative */
fcmpzd d0
fmstat
vnegmi.f64 d0, d0 /* negate d0 if it is negative */
bx lr
1: fcmpzd d0
fmstat
vnegpl.f64 d0, d0 /* negate d0 if it is positive */
bx lr
#elif defined(_X86_) || defined(__i386__)
movl 24(%esp),%edx
movl 12(%esp),%eax
andl $0x8000,%edx
andl $0x7fff,%eax
orl %edx,%eax
movl %eax,12(%esp)
fldt 4(%esp)
ret
#endif

View File

@ -0,0 +1,65 @@
/*
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>
extern long double __cosl_internal (long double);
__FLT_TYPE
__FLT_ABI(cos) (__FLT_TYPE x)
{
int x_class = fpclassify (x);
if (x_class == FP_NAN)
{
__FLT_RPT_DOMAIN ("cos", x, 0.0, x);
return x;
}
else if (x_class == FP_INFINITE)
{
__FLT_RPT_DOMAIN ("cos", x, 0.0, __FLT_NAN);
return __FLT_NAN;
}
return (__FLT_TYPE) __cosl_internal ((long double) x);
}

View File

@ -0,0 +1,45 @@
/**
* 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_mconf.h"
#ifndef _SET_ERRNO
#define _SET_ERRNO(x)
#endif
long double coshl(long double x)
{
long double y;
int x_class = fpclassify (x);
if (x_class == FP_NAN)
{
errno = EDOM;
return x;
}
else if (x_class == FP_INFINITE)
{
errno = ERANGE;
return x;
}
x = fabsl (x);
if (x > (MAXLOGL + LOGE2L))
{
errno = ERANGE;
#ifdef INFINITIES
return (INFINITYL);
#else
return (MAXNUML);
#endif
}
if (x >= (MAXLOGL - LOGE2L))
{
y = expl(0.5L * x);
y = (0.5L * y) * y;
return y;
}
y = expl(x);
y = 0.5L * (y + 1.0L / y);
return y;
}

46
winsup/cygwin/math/cosl.c Normal file
View File

@ -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 "cos.def.h"

View File

@ -0,0 +1,55 @@
/**
* 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 "cosl_internal.S"
.text
#ifdef __x86_64__
.align 8
#else
.align 4
#endif
.globl __MINGW_USYMBOL(__cosl_internal)
.def __MINGW_USYMBOL(__cosl_internal); .scl 2; .type 32; .endef
__MINGW_USYMBOL(__cosl_internal):
#ifdef __x86_64__
fldt (%rdx)
fcos
fnstsw %ax
testl $0x400,%eax
jz 1f
fldpi
fadd %st(0)
fxch %st(1)
2: fprem1
fnstsw %ax
testl $0x400,%eax
jnz 2b
fstp %st(1)
fcos
1: movq %rcx,%rax
movq $0,8(%rcx)
fstpt (%rcx)
ret
#else
fldt 4(%esp)
fcos
fnstsw %ax
testl $0x400,%eax
jnz 1f
ret
1: fldpi
fadd %st(0)
fxch %st(1)
2: fprem1
fnstsw %ax
testl $0x400,%eax
jnz 2b
fstp %st(1)
fcos
ret
#endif

View File

@ -0,0 +1,75 @@
/**
* 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.
*/
void sincos (double __x, double *p_sin, double *p_cos);
void sincosl (long double __x, long double *p_sin, long double *p_cos);
void sincosf (float __x, float *p_sin, float *p_cos);
void sincos (double __x, double *p_sin, double *p_cos)
{
long double c, s;
__asm__ __volatile__ ("fsincos\n\t"
"fnstsw %%ax\n\t"
"testl $0x400, %%eax\n\t"
"jz 1f\n\t"
"fldpi\n\t"
"fadd %%st(0)\n\t"
"fxch %%st(1)\n\t"
"2: fprem1\n\t"
"fnstsw %%ax\n\t"
"testl $0x400, %%eax\n\t"
"jnz 2b\n\t"
"fstp %%st(1)\n\t"
"fsincos\n\t"
"1:" : "=t" (c), "=u" (s) : "0" (__x));
*p_sin = (double) s;
*p_cos = (double) c;
}
void sincosf (float __x, float *p_sin, float *p_cos)
{
long double c, s;
__asm__ __volatile__ ("fsincos\n\t"
"fnstsw %%ax\n\t"
"testl $0x400, %%eax\n\t"
"jz 1f\n\t"
"fldpi\n\t"
"fadd %%st(0)\n\t"
"fxch %%st(1)\n\t"
"2: fprem1\n\t"
"fnstsw %%ax\n\t"
"testl $0x400, %%eax\n\t"
"jnz 2b\n\t"
"fstp %%st(1)\n\t"
"fsincos\n\t"
"1:" : "=t" (c), "=u" (s) : "0" (__x));
*p_sin = (float) s;
*p_cos = (float) c;
}
void sincosl (long double __x, long double *p_sin, long double *p_cos)
{
long double c, s;
__asm__ __volatile__ ("fsincos\n\t"
"fnstsw %%ax\n\t"
"testl $0x400, %%eax\n\t"
"jz 1f\n\t"
"fldpi\n\t"
"fadd %%st(0)\n\t"
"fxch %%st(1)\n\t"
"2: fprem1\n\t"
"fnstsw %%ax\n\t"
"testl $0x400, %%eax\n\t"
"jnz 2b\n\t"
"fstp %%st(1)\n\t"
"fsincos\n\t"
"1:" : "=t" (c), "=u" (s) : "0" (__x));
*p_sin = s;
*p_cos = c;
}

View File

@ -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 __complex__ __cdecl
__FLT_ABI(cpow) (__FLT_TYPE __complex__ z, __FLT_TYPE __complex__ x)
{
return __FLT_ABI(cexp) (x * __FLT_ABI(clog) (z));
}

View File

@ -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 "cpow.def.h"

View File

@ -0,0 +1,58 @@
/*
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(cproj) (__FLT_TYPE __complex__ z)
{
__complex__ __FLT_TYPE ret;
if (isinf (__real__ z) || isinf (__imag__ z))
{
__real__ ret = INFINITY;
__imag__ ret = __FLT_ABI(copysign) (__FLT_CST(0.0), __imag__ z);
return ret;
}
return z;
}

View File

@ -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 "cproj.def.h"

View File

@ -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
__FLT_ABI(creal) (__FLT_TYPE __complex__ z)
{
return __real__ z;
}

View File

@ -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 "creal.def.h"

View File

@ -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(csin) (__FLT_TYPE __complex__ z)
{
/* Annex G.6: csin(z) = -i csinh (iz) */
__complex__ __FLT_TYPE ret;
__complex__ __FLT_TYPE x;
__real__ x = -__imag__ z;
__imag__ x = __real__ z;
x = __FLT_ABI(csinh) (x);
__real__ ret = __imag__ x;
__imag__ ret = -__real__ x;
return ret;
}

View File

@ -0,0 +1,107 @@
/*
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(csinh) (__FLT_TYPE __complex__ z)
{
__complex__ __FLT_TYPE ret;
__FLT_TYPE s_x, c_x;
int negate = signbit (__real__ z);
int r_class = fpclassify (__real__ z);
int i_class = fpclassify (__imag__ z);
__real__ z = __FLT_ABI(fabs) (__real__ 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 = negate ? -__FLT_HUGE_VAL : __FLT_HUGE_VAL;
__imag__ ret = __imag__ 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);
if (negate)
__real__ ret = -__real__ ret;
return ret;
}
if (i_class == FP_NAN || i_class == FP_INFINITE)
{
__real__ ret = (r_class == FP_ZERO
? (__FLT_ABI(copysign) (__FLT_CST(0.0), negate ? -__FLT_CST(1.0) : __FLT_CST(1.0))) : __FLT_NAN);
__imag__ ret = (r_class == FP_ZERO ? (__FLT_NAN + __FLT_NAN) : __FLT_NAN);
return ret;
}
__FLT_ABI(sincos) (__imag__ z, &s_x, &c_x);
__real__ ret = __FLT_ABI(sinh) (__real__ z) * c_x;
__imag__ ret = __FLT_ABI(cosh) (__real__ z) * s_x;
if (negate)
__real__ ret = -__real__ ret;
return ret;
}

View File

@ -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 "csinh.def.h"
#include "csin.def.h"

View File

@ -0,0 +1,122 @@
/*
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(csqrt) (__FLT_TYPE __complex__ z)
{
__complex__ __FLT_TYPE ret;
__FLT_TYPE d, r, s;
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_HUGE_VAL;
__imag__ ret = __imag__ z;
return ret;
}
if (r_class == FP_INFINITE)
{
if (__real__ z < __FLT_CST(0.0))
{
__real__ ret = i_class == FP_NAN ? __FLT_NAN : __FLT_CST(0.0);
__imag__ ret = __FLT_ABI(copysign) (__FLT_HUGE_VAL, __imag__ z);
return ret;
}
__real__ ret = __real__ z;
__imag__ ret = (i_class == FP_NAN
? __FLT_NAN : __FLT_ABI(copysign) (__FLT_CST(0.0), __imag__ z));
return ret;
}
__real__ ret = __FLT_NAN;
__imag__ ret = __FLT_NAN;
return ret;
}
if (i_class == FP_ZERO)
{
if (__real__ z < __FLT_CST(0.0))
{
__real__ ret = __FLT_CST(0.0);
__imag__ ret = __FLT_ABI(copysign) (__FLT_ABI(sqrt) (-__real__ z), __imag__ z);
}
else
{
__real__ ret = __FLT_ABI(fabs) (__FLT_ABI(sqrt) (__real__ z));
__imag__ ret = __FLT_ABI(copysign) (__FLT_CST(0.0), __imag__ z);
}
return ret;
}
if (r_class == FP_ZERO)
{
r = __FLT_ABI(sqrt) (__FLT_CST(0.5) * __FLT_ABI(fabs) (__imag__ z));
__real__ ret = r;
__imag__ ret = __FLT_ABI(copysign) (r, __imag__ z);
return ret;
}
d = __FLT_ABI(hypot) (__real__ z, __imag__ z);
if (__real__ z > __FLT_CST(0.0))
{
r = __FLT_ABI(sqrt) (__FLT_CST(0.5) * d + __FLT_CST(0.5) * __real__ z);
s = (__FLT_CST(0.5) * __imag__ z) / r;
}
else
{
s = __FLT_ABI(sqrt) (__FLT_CST(0.5) * d - __FLT_CST(0.5) * __real__ z);
r = __FLT_ABI(fabs) ((__FLT_CST(0.5) * __imag__ z) / s);
}
__real__ ret = r;
__imag__ ret = __FLT_ABI(copysign) (s, __imag__ z);
return ret;
}

View File

@ -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 "csqrt.def.h"

View File

@ -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(ctan) (__FLT_TYPE __complex__ z)
{
/* Annex G.6: ctan(z) = -i ctanh (iz) */
__complex__ __FLT_TYPE ret;
__complex__ __FLT_TYPE x;
__real__ x = -__imag__ z;
__imag__ x = __real__ z;
x = __FLT_ABI(ctanh) (x);
__real__ ret = __imag__ x;
__imag__ ret = -__real__ x;
return ret;
}

View File

@ -0,0 +1,94 @@
/*
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(ctanh) (__FLT_TYPE __complex__ z)
{
__complex__ __FLT_TYPE ret;
__FLT_TYPE s, c, d;
if (!isfinite (__real__ z) || !isfinite (__imag__ z))
{
if (isinf (__real__ z))
{
__real__ ret = __FLT_ABI(copysign) (__FLT_CST(1.0), __real__ z);
/* fmod will return NaN if __imag__ z is infinity. This is actually
OK, because imaginary infinity returns a + or - zero (unspecified).
For +x, sin (x) is negative if fmod (x, 2pi) > pi.
For -x, sin (x) is positive if fmod (x, 2pi) < pi.
We use epsilon to ensure that the zeros are detected properly with
float and long double comparisons. */
s = __FLT_ABI(fmod) (__imag__ z, __FLT_PI);
if (signbit (__imag__ z))
__imag__ ret = s + __FLT_PI_2 < -__FLT_EPSILON ? 0.0 : -0.0;
else
__imag__ ret = s - __FLT_PI_2 > __FLT_EPSILON ? -0.0 : 0.0;
return ret;
}
if (__imag__ z == __FLT_CST(0.0))
return z;
__real__ ret = __FLT_NAN;
__imag__ ret = __FLT_NAN;
return ret;
}
__FLT_ABI(sincos) (__FLT_CST(2.0) * __imag__ z, &s, &c);
d = (__FLT_ABI(cosh) (__FLT_CST(2.0) * __real__ z) + c);
if (d == __FLT_CST(0.0))
{
__complex__ __FLT_TYPE ez = __FLT_ABI(cexp) (z);
__complex__ __FLT_TYPE emz = __FLT_ABI(cexp) (-z);
return (ez - emz) / (ez + emz);
}
__real__ ret = __FLT_ABI(sinh) (__FLT_CST(2.0) * __real__ z) / d;
__imag__ ret = s / d;
return ret;
}

View File

@ -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 "ctanh.def.h"
#include "ctan.def.h"

303
winsup/cygwin/math/erfl.c Normal file
View File

@ -0,0 +1,303 @@
/**
* 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.
*/
/* erfl.c
*
* Error function
*
*
*
* SYNOPSIS:
*
* long double x, y, erfl();
*
* y = erfl( x );
*
*
*
* DESCRIPTION:
*
* The integral is
*
* x
* -
* 2 | | 2
* erf(x) = -------- | exp( - t ) dt.
* sqrt(pi) | |
* -
* 0
*
* The magnitude of x is limited to about 106.56 for IEEE
* arithmetic; 1 or -1 is returned outside this range.
*
* For 0 <= |x| < 1, erf(x) = x * P6(x^2)/Q6(x^2);
* Otherwise: erf(x) = 1 - erfc(x).
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE 0,1 50000 2.0e-19 5.7e-20
*
*/
/* erfcl.c
*
* Complementary error function
*
*
*
* SYNOPSIS:
*
* long double x, y, erfcl();
*
* y = erfcl( x );
*
*
*
* DESCRIPTION:
*
*
* 1 - erf(x) =
*
* inf.
* -
* 2 | | 2
* erfc(x) = -------- | exp( - t ) dt
* sqrt(pi) | |
* -
* x
*
*
* For small x, erfc(x) = 1 - erf(x); otherwise rational
* approximations are computed.
*
* A special function expx2l.c is used to suppress error amplification
* in computing exp(-x^2).
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE 0,13 50000 8.4e-19 9.7e-20
* IEEE 6,106.56 20000 2.9e-19 7.1e-20
*
*
* ERROR MESSAGES:
*
* message condition value returned
* erfcl underflow x^2 > MAXLOGL 0.0
*
*
*/
/*
Modified from file ndtrl.c
Cephes Math Library Release 2.3: January, 1995
Copyright 1984, 1995 by Stephen L. Moshier
*/
#include <math.h>
#include "cephes_mconf.h"
long double erfl(long double x);
/* erfc(x) = exp(-x^2) P(1/x)/Q(1/x)
1/8 <= 1/x <= 1
Peak relative error 5.8e-21 */
static const uLD P[10] = {
{ { 0x4bf0,0x9ad8,0x7a03,0x86c7,0x401d, 0, 0, 0 } },
{ { 0xdf23,0xd843,0x4032,0x8881,0x401e, 0, 0, 0 } },
{ { 0xd025,0xcfd5,0x8494,0x88d3,0x401e, 0, 0, 0 } },
{ { 0xb6d0,0xc92b,0x5417,0xacb1,0x401d, 0, 0, 0 } },
{ { 0xada8,0x356a,0x4982,0x94a6,0x401c, 0, 0, 0 } },
{ { 0x4e13,0xcaee,0x9e31,0xb258,0x401a, 0, 0, 0 } },
{ { 0x5840,0x554d,0x37a3,0x9239,0x4018, 0, 0, 0 } },
{ { 0x3b58,0x3da2,0xaf02,0x9780,0x4015, 0, 0, 0 } },
{ { 0x0144,0x489e,0xbe68,0x9c31,0x4011, 0, 0, 0 } },
{ { 0x333b,0xd9e6,0xd404,0x986f,0xbfee, 0, 0, 0 } }
};
static const uLD Q[] = {
{ { 0x0e43,0x302d,0x79ed,0x86c7,0x401d, 0, 0, 0 } },
{ { 0xf817,0x9128,0xc0f8,0xd48b,0x401e, 0, 0, 0 } },
{ { 0x8eae,0x8dad,0x6eb4,0x9aa2,0x401f, 0, 0, 0 } },
{ { 0x00e7,0x7595,0xcd06,0x88bb,0x401f, 0, 0, 0 } },
{ { 0x4991,0xcfda,0x52f1,0xa2a9,0x401e, 0, 0, 0 } },
{ { 0xc39d,0xe415,0xc43d,0x87c0,0x401d, 0, 0, 0 } },
{ { 0xa75d,0x436f,0x30dd,0xa027,0x401b, 0, 0, 0 } },
{ { 0xc4cb,0x305a,0xbf78,0x8220,0x4019, 0, 0, 0 } },
{ { 0x3708,0x33b1,0x07fa,0x8644,0x4016, 0, 0, 0 } },
{ { 0x24fa,0x96f6,0x7153,0x8a6c,0x4012, 0, 0, 0 } }
};
/* erfc(x) = exp(-x^2) 1/x R(1/x^2) / S(1/x^2)
1/128 <= 1/x < 1/8
Peak relative error 1.9e-21 */
static const uLD R[] = {
{ { 0x260a,0xab95,0x2fc7,0xe7c4,0x4000, 0, 0, 0 } },
{ { 0x4761,0x613e,0xdf6d,0xe58e,0x4001, 0, 0, 0 } },
{ { 0x0615,0x4b00,0x575f,0xdc7b,0x4000, 0, 0, 0 } },
{ { 0x521d,0x8527,0x3435,0x8dc2,0x3ffe, 0, 0, 0 } },
{ { 0x22cf,0xc711,0x6c5b,0xdcfb,0x3ff9, 0, 0, 0 } }
};
static const uLD S[] = {
{ { 0x5de6,0x17d7,0x54d6,0xaba9,0x4002, 0, 0, 0 } },
{ { 0x55d5,0xd300,0xe71e,0xf564,0x4002, 0, 0, 0 } },
{ { 0xb611,0x8f76,0xf020,0xd255,0x4001, 0, 0, 0 } },
{ { 0x3684,0x3798,0xb793,0x80b0,0x3fff, 0, 0, 0 } },
{ { 0xf5af,0x2fb2,0x1e57,0xc3d7,0x3ffa, 0, 0, 0 } }
};
/* erf(x) = x T(x^2)/U(x^2)
0 <= x <= 1
Peak relative error 7.6e-23 */
static const uLD T[] = {
{ { 0xfd7a,0x3a1a,0x705b,0xe0c4,0x3ffb, 0, 0, 0 } },
{ { 0x3128,0xc337,0x3716,0xace5,0x4001, 0, 0, 0 } },
{ { 0x9517,0x4e93,0x540e,0x8f97,0x4007, 0, 0, 0 } },
{ { 0x6118,0x6059,0x9093,0xa757,0x400a, 0, 0, 0 } },
{ { 0xb954,0xa987,0xc60c,0xbc83,0x400e, 0, 0, 0 } },
{ { 0x7a56,0xe45a,0xa4bd,0x975b,0x4010, 0, 0, 0 } },
{ { 0xc446,0x6bab,0x0b2a,0x86d0,0x4013, 0, 0, 0 } }
};
static const uLD U[] = {
{ { 0x3453,0x1f8e,0xf688,0xb507,0x4004, 0, 0, 0 } },
{ { 0x71ac,0xb12f,0x21ca,0xf2e2,0x4008, 0, 0, 0 } },
{ { 0xffe8,0x9cac,0x3b84,0xc2ac,0x400c, 0, 0, 0 } },
{ { 0x481d,0x445b,0xc807,0xc232,0x400f, 0, 0, 0 } },
{ { 0x9ad5,0x1aef,0x45b1,0xe25e,0x4011, 0, 0, 0 } },
{ { 0x71a7,0x1cad,0x012e,0xeef3,0x4012, 0, 0, 0 } }
};
/* expx2l.c
*
* Exponential of squared argument
*
*
*
* SYNOPSIS:
*
* long double x, y, expmx2l();
* int sign;
*
* y = expx2l( x );
*
*
*
* DESCRIPTION:
*
* Computes y = exp(x*x) while suppressing error amplification
* that would ordinarily arise from the inexactness of the
* exponential argument x*x.
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE -106.566, 106.566 10^5 1.6e-19 4.4e-20
*
*/
#define M 32768.0L
#define MINV 3.0517578125e-5L
static long double expx2l (long double x)
{
long double u, u1, m, f;
x = fabsl (x);
/* Represent x as an exact multiple of M plus a residual.
M is a power of 2 chosen so that exp(m * m) does not overflow
or underflow and so that |x - m| is small. */
m = MINV * floorl(M * x + 0.5L);
f = x - m;
/* x^2 = m^2 + 2mf + f^2 */
u = m * m;
u1 = 2 * m * f + f * f;
if ((u + u1) > MAXLOGL)
return (INFINITYL);
/* u is exact, u1 is small. */
u = expl(u) * expl(u1);
return (u);
}
long double erfcl(long double a)
{
long double p, q, x, y, z;
if (isinf (a))
return (signbit(a) ? 2.0 : 0.0);
x = fabsl (a);
if (x < 1.0L)
return (1.0L - erfl(a));
z = a * a;
if (z > MAXLOGL)
{
under:
mtherr("erfcl", UNDERFLOW);
errno = ERANGE;
return (signbit(a) ? 2.0 : 0.0);
}
/* Compute z = expl(a * a). */
z = expx2l(a);
y = 1.0L/x;
if (x < 8.0L)
{
p = polevll(y, P, 9);
q = p1evll(y, Q, 10);
}
else
{
q = y * y;
p = y * polevll(q, R, 4);
q = p1evll(q, S, 5);
}
y = p/(q * z);
if (a < 0.0L)
y = 2.0L - y;
if (y == 0.0L)
goto under;
return (y);
}
long double erfl(long double x)
{
long double y, z;
if (x == 0.0L)
return (x);
if (isinf (x))
return (signbit(x) ? -1.0L : 1.0L);
if (fabsl(x) > 1.0L)
return (1.0L - erfcl(x));
z = x * x;
y = x * polevll(z, T, 6) / p1evll(z, U, 6);
return (y);
}

View File

@ -0,0 +1,136 @@
/*
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>
static long double c0 = 1.44268798828125L; // INV_LN2
static long double c1 = 7.05260771340735992468e-6L;
static long double
__expl_internal (long double x)
{
long double res = 0.0L;
asm ("fldl2e\n\t" /* 1 log2(e) */
"fmul %%st(1),%%st\n\t" /* 1 x log2(e) */
#ifdef __x86_64__
"subq $8, %%rsp\n"
"fnstcw 4(%%rsp)\n"
"movzwl 4(%%rsp), %%eax\n"
"orb $12, %%ah\n"
"movw %%ax, (%%rsp)\n"
"fldcw (%%rsp)\n"
"frndint\n\t" /* 1 i */
"fld %%st(1)\n\t" /* 2 x */
"frndint\n\t" /* 2 xi */
"fldcw 4(%%rsp)\n"
"addq $8, %%rsp\n"
#else
"push %%eax\n\tsubl $8, %%esp\n"
"fnstcw 4(%%esp)\n"
"movzwl 4(%%esp), %%eax\n"
"orb $12, %%ah\n"
"movw %%ax, (%%esp)\n"
"fldcw (%%esp)\n"
"frndint\n\t" /* 1 i */
"fld %%st(1)\n\t" /* 2 x */
"frndint\n\t" /* 2 xi */
"fldcw 4(%%esp)\n"
"addl $8, %%esp\n\tpop %%eax\n"
#endif
"fld %%st(1)\n\t" /* 3 i */
"fldt %2\n\t" /* 4 c0 */
"fld %%st(2)\n\t" /* 5 xi */
"fmul %%st(1),%%st\n\t" /* 5 c0 xi */
"fsubp %%st,%%st(2)\n\t" /* 4 f = c0 xi - i */
"fld %%st(4)\n\t" /* 5 x */
"fsub %%st(3),%%st\n\t" /* 5 xf = x - xi */
"fmulp %%st,%%st(1)\n\t" /* 4 c0 xf */
"faddp %%st,%%st(1)\n\t" /* 3 f = f + c0 xf */
"fldt %3\n\t" /* 4 */
"fmul %%st(4),%%st\n\t" /* 4 c1 * x */
"faddp %%st,%%st(1)\n\t" /* 3 f = f + c1 * x */
"f2xm1\n\t" /* 3 2^(fract(x * log2(e))) - 1 */
"fld1\n\t" /* 4 1.0 */
"faddp\n\t" /* 3 2^(fract(x * log2(e))) */
"fstp %%st(1)\n\t" /* 2 */
"fscale\n\t" /* 2 scale factor is st(1); e^x */
"fstp %%st(1)\n\t" /* 1 */
"fstp %%st(1)\n\t" /* 0 */
: "=t" (res) : "0" (x), "m" (c0), "m" (c1) : "ax", "dx");
return res;
}
__FLT_TYPE
__FLT_ABI(exp) (__FLT_TYPE x)
{
int x_class = fpclassify (x);
if (x_class == FP_NAN)
{
__FLT_RPT_DOMAIN ("exp", x, 0.0, x);
return x;
}
else if (x_class == FP_INFINITE)
{
__FLT_TYPE r = (signbit (x) ? __FLT_CST (0.0) : __FLT_HUGE_VAL);
__FLT_RPT_ERANGE ("exp", x, 0.0, r, signbit (x));
return r;
}
else if (x_class == FP_ZERO)
{
return __FLT_CST (1.0);
}
else if (x > __FLT_MAXLOG)
{
__FLT_RPT_ERANGE ("exp", x, 0.0, __FLT_HUGE_VAL, 1);
return __FLT_HUGE_VAL;
}
else if (x < __FLT_MINLOG)
{
return __FLT_CST(0.0);
}
else
return (__FLT_TYPE) __expl_internal ((long double) x);
}

View File

@ -0,0 +1,8 @@
#undef exp10l
#include <math.h>
long double
exp10l (long double x)
{
return powl (10.0L, x);
}

94
winsup/cygwin/math/exp2.S Normal file
View File

@ -0,0 +1,94 @@
/**
* 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 "exp2.S"
.text
#ifdef __x86_64__
.align 8
#else
.align 4
#endif
.globl __MINGW_USYMBOL(exp2)
.def __MINGW_USYMBOL(exp2); .scl 2; .type 32; .endef
__MINGW_USYMBOL(exp2):
#ifdef __x86_64__
subq $24, %rsp
movsd %xmm0,(%rsp)
fldl (%rsp)
fxam /* Is NaN or +-Inf? */
fstsw %ax
movb $0x45, %dh
andb %ah, %dh
cmpb $0x05, %dh
je 1f /* Is +-Inf, jump. */
fld %st
subq $8, %rsp /* int(x) */
fnstcw 4(%rsp)
movzwl 4(%rsp), %eax
orb $12, %ah
movw %ax, (%rsp)
fldcw (%rsp)
frndint
fldcw 4(%rsp)
addq $8, %rsp
fsubr %st,%st(1) /* fract(x) */
fxch
f2xm1 /* 2^(fract(x)) - 1 */
fld1
faddp /* 2^(fract(x)) */
fscale /* e^x */
fstp %st(1)
fstpl (%rsp)
movsd (%rsp),%xmm0
addq $24, %rsp
ret
1: testl $0x200, %eax /* Test sign. */
jz 2f /* If positive, jump. */
fstp %st
fldz /* Set result to 0. */
2: fstpl (%rsp)
movsd (%rsp),%xmm0
addq $24,%rsp
ret
#else
fldl 4(%esp)
/* I added the following ugly construct because exp(+-Inf) resulted
in NaN. The ugliness results from the bright minds at Intel.
For the i686 the code can be written better.
-- drepper@cygnus.com. */
fxam /* Is NaN or +-Inf? */
fstsw %ax
movb $0x45, %dh
andb %ah, %dh
cmpb $0x05, %dh
je 1f /* Is +-Inf, jump. */
fld %st
subl $8, %esp /* int(x) */
fnstcw 4(%esp)
movzwl 4(%esp), %eax
orb $12, %ah
movw %ax, (%esp)
fldcw (%esp)
frndint
fldcw 4(%esp)
addl $8, %esp
fsubr %st,%st(1) /* fract(x) */
fxch
f2xm1 /* 2^(fract(x)) - 1 */
fld1
faddp /* 2^(fract(x)) */
fscale /* e^x */
fstp %st(1)
ret
1: testl $0x200, %eax /* Test sign. */
jz 2f /* If positive, jump. */
fstp %st
fldz /* Set result to 0. */
2: ret
#endif

View File

@ -0,0 +1,92 @@
/**
* 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 "exp2l.S"
.text
#ifdef __x86_64__
.align 8
#else
.align 4
#endif
.globl __MINGW_USYMBOL(exp2l)
.def __MINGW_USYMBOL(exp2l); .scl 2; .type 32; .endef
__MINGW_USYMBOL(exp2l):
#ifdef __x86_64__
fldt (%rdx)
fxam /* Is NaN or +-Inf? */
fstsw %ax
movb $0x45, %dh
andb %ah, %dh
cmpb $0x05, %dh
je 1f /* Is +-Inf, jump. */
fld %st
subq $8, %rsp /* int(x) */
fnstcw 4(%rsp)
movzwl 4(%rsp), %eax
orb $12, %ah
movw %ax, (%rsp)
fldcw (%rsp)
frndint
fldcw 4(%rsp)
addq $8, %rsp
fsubr %st,%st(1) /* fract(x) */
fxch
f2xm1 /* 2^(fract(x)) - 1 */
fld1
faddp /* 2^(fract(x)) */
fscale /* e^x */
fstp %st(1)
movq %rcx,%rax
movq $0,8(%rcx)
fstpt (%rcx)
ret
1: testl $0x200, %eax /* Test sign. */
jz 2f /* If positive, jump. */
fstp %st
fldz /* Set result to 0. */
2: movq %rcx,%rax
movq $0,8(%rcx)
fstpt (%rcx)
ret
#else
fldt 4(%esp)
/* I added the following ugly construct because exp(+-Inf) resulted
in NaN. The ugliness results from the bright minds at Intel.
For the i686 the code can be written better.
-- drepper@cygnus.com. */
fxam /* Is NaN or +-Inf? */
fstsw %ax
movb $0x45, %dh
andb %ah, %dh
cmpb $0x05, %dh
je 1f /* Is +-Inf, jump. */
fld %st
subl $8, %esp /* int(x) */
fnstcw 4(%esp)
movzwl 4(%esp), %eax
orb $12, %ah
movw %ax, (%esp)
fldcw (%esp)
frndint
fldcw 4(%esp)
addl $8, %esp
fsubr %st,%st(1) /* fract(x) */
fxch
f2xm1 /* 2^(fract(x)) - 1 */
fld1
faddp /* 2^(fract(x)) */
fscale /* e^x */
fstp %st(1)
ret
1: testl $0x200, %eax /* Test sign. */
jz 2f /* If positive, jump. */
fstp %st
fldz /* Set result to 0. */
2: ret
#endif

46
winsup/cygwin/math/expl.c Normal file
View File

@ -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 "exp.def.h"

View File

@ -0,0 +1,72 @@
/*
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>
__FLT_TYPE
__FLT_ABI(expm1) (__FLT_TYPE x)
{
int x_class = fpclassify (x);
if (x_class == FP_NAN)
{
__FLT_RPT_DOMAIN ("expm1", x, 0.0, x);
return x;
}
else if (x_class == FP_INFINITE)
{
return (signbit (x) ? -__FLT_CST(1.0) : __FLT_HUGE_VAL);
}
else if (x_class == FP_ZERO)
{
return x;
}
if (__FLT_ABI (fabs) (x) < __FLT_LOGE2)
{
x /= __FLT_LOGE2;
__asm__ __volatile__ ("f2xm1" : "=t" (x) : "0" (x));
return x;
}
return __FLT_ABI (exp) (x) - __FLT_CST (1.0);
}

View File

@ -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 "expm1.def.h"

View File

@ -0,0 +1,18 @@
/**
* 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 fabsl (long double x);
long double
fabsl (long double x)
{
#if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_)
long double res = 0.0L;
asm ("fabs;" : "=t" (res) : "0" (x));
return res;
#elif defined(__arm__) || defined(_ARM_)
return __builtin_fabsl (x);
#endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) */
}

View File

@ -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.
*/
#ifndef _MINGWEX_FASTMATH_H_
#define _MINGWEX_FASTMATH_H_
/* Fast math inlines
No range or domain checks. No setting of errno. No tweaks to
protect precision near range limits. */
/* For now this is an internal header with just the functions that
are currently used in building libmingwex.a math components */
/* FIXME: We really should get rid of the code duplication using euther
C++ templates or tgmath-type macros. */
static __inline__ double __fast_sqrt (double x)
{
double res;
asm __volatile__ ("fsqrt" : "=t" (res) : "0" (x));
return res;
}
static __inline__ long double __fast_sqrtl (long double x)
{
long double res;
asm __volatile__ ("fsqrt" : "=t" (res) : "0" (x));
return res;
}
static __inline__ float __fast_sqrtf (float x)
{
float res;
asm __volatile__ ("fsqrt" : "=t" (res) : "0" (x));
return res;
}
static __inline__ double __fast_log (double x)
{
double res;
asm __volatile__
("fldln2\n\t"
"fxch\n\t"
"fyl2x"
: "=t" (res) : "0" (x) : "st(1)");
return res;
}
static __inline__ long double __fast_logl (long double x)
{
long double res;
asm __volatile__
("fldln2\n\t"
"fxch\n\t"
"fyl2x"
: "=t" (res) : "0" (x) : "st(1)");
return res;
}
static __inline__ float __fast_logf (float x)
{
float res;
asm __volatile__
("fldln2\n\t"
"fxch\n\t"
"fyl2x"
: "=t" (res) : "0" (x) : "st(1)");
return res;
}
static __inline__ double __fast_log1p (double x)
{
double res;
/* fyl2xp1 accurate only for |x| <= 1.0 - 0.5 * sqrt (2.0) */
if (fabs (x) >= 1.0 - 0.5 * 1.41421356237309504880)
res = __fast_log (1.0 + x);
else
asm __volatile__
("fldln2\n\t"
"fxch\n\t"
"fyl2xp1"
: "=t" (res) : "0" (x) : "st(1)");
return res;
}
static __inline__ long double __fast_log1pl (long double x)
{
long double res;
/* fyl2xp1 accurate only for |x| <= 1.0 - 0.5 * sqrt (2.0) */
if (fabsl (x) >= 1.0L - 0.5L * 1.41421356237309504880L)
res = __fast_logl (1.0L + x);
else
asm __volatile__
("fldln2\n\t"
"fxch\n\t"
"fyl2xp1"
: "=t" (res) : "0" (x) : "st(1)");
return res;
}
static __inline__ float __fast_log1pf (float x)
{
float res;
/* fyl2xp1 accurate only for |x| <= 1.0 - 0.5 * sqrt (2.0) */
if (fabsf (x) >= 1.0 - 0.5 * 1.41421356237309504880)
res = __fast_logf (1.0 + x);
else
asm __volatile__
("fldln2\n\t"
"fxch\n\t"
"fyl2xp1"
: "=t" (res) : "0" (x) : "st(1)");
return res;
}
#endif

View File

@ -0,0 +1,24 @@
/**
* 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 <errno.h>
#include <math.h>
long double
fdiml (long double x, long double y)
{
int cx = fpclassify (x), cy = fpclassify (y);
long double r;
if (cx == FP_NAN || cy == FP_NAN
|| (y < 0 && cx == FP_INFINITE && cy == FP_INFINITE))
return x - y; /* Take care invalid flag is raised. */
if (x <= y)
return 0.0;
r = x - y;
if (fpclassify (r) == FP_INFINITE)
errno = ERANGE;
return r;
}

View File

@ -0,0 +1,19 @@
#include <math.h>
int
finite (double x)
{
return __builtin_isfinite (x);
}
int
finitef (float x)
{
return __builtin_isfinite (x);
}
int
finitel (long double x)
{
return __builtin_isfinite (x);
}

View File

@ -0,0 +1,72 @@
/**
* 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 "floorl.S"
.text
#ifdef __x86_64__
.align 8
#else
.align 4
#endif
.globl __MINGW_USYMBOL(floorl)
.def __MINGW_USYMBOL(floorl); .scl 2; .type 32; .endef
__MINGW_USYMBOL(floorl):
#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 $0x400,%edx /* round towards -oo */
orl 8(%rsp),%edx
andl $0xf7ff,%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, #0x00800000 /* Round towards Minus 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) /* 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 $0x400,%edx /* round towards -oo */
orl 4(%esp),%edx
andl $0xf7ff,%edx
movl %edx,(%esp)
fldcw (%esp) /* load modified control word */
frndint /* round */
fldcw 4(%esp) /* restore original control word */
addl $8,%esp
ret
#endif

12
winsup/cygwin/math/fmal.c Normal file
View File

@ -0,0 +1,12 @@
/**
* 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 fmal ( long double _x, long double _y, long double _z);
long double
fmal ( long double _x, long double _y, long double _z)
{
return ((_x * _y) + _z);
}

View File

@ -0,0 +1,13 @@
/**
* 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>
long double
fmaxl (long double _x, long double _y)
{
return (__builtin_isgreaterequal (_x, _y) || __builtin_isnan (_y))
? _x : _y;
}

View File

@ -0,0 +1,12 @@
/**
* 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>
long double
fminl (long double _x, long double _y)
{
return ((__builtin_islessequal(_x, _y) || __builtin_isnan (_y)) ? _x : _y );
}

View File

@ -0,0 +1,20 @@
/**
* 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 fmodl (long double x, long double y);
long double
fmodl (long double x, long double y)
{
long double res = 0.0L;
asm ("1:\tfprem\n\t"
"fstsw %%ax\n\t"
"sahf\n\t"
"jp 1b\n\t"
"fstp %%st(1)"
: "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
return res;
}

130
winsup/cygwin/math/frexpl.S Normal file
View File

@ -0,0 +1,130 @@
/**
* 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>
/*
* frexpl(long double x, int* expnt) extracts the exponent from x.
* It returns an integer power of two to expnt and the significand
* between 0.5 and 1 to y. Thus x = y * 2**expn.
*/
#ifdef __x86_64__
.align 8
#else
.align 2
#endif
.globl __MINGW_USYMBOL(frexpl)
__MINGW_USYMBOL(frexpl):
#ifdef __x86_64__
pushq %rbp
movq %rsp,%rbp
subq $48,%rsp
pushq %rsi
fldt (%rdx)
movq %rcx,%r9
fld %st(0)
fstpt -12(%rbp)
leaq -4(%rbp),%rcx
movw -4(%rbp),%dx
andl $32767,%edx
jne L25
fldz
fucompp
fnstsw %ax
andb $68,%ah
xorb $64,%ah
jne L21
movl $0,(%r8)
fldz
jmp L24
.align 4,0x90
.align 4,0x90
L21:
fldt -12(%rbp)
fadd %st(0),%st
fstpt -12(%rbp)
decl %edx
movw (%rcx),%si
andl $32767,%esi
jne L22
cmpl $-66,%edx
jg L21
L22:
add %esi,%edx
jmp L19
.align 2,0x90
L25:
fstp %st(0)
L19:
addl $-16382,%edx
movl %edx,(%r8)
movw (%rcx),%ax
andl $-32768,%eax
orl $16382,%eax
movw %ax,(%rcx)
fldt -12(%rbp)
L24:
popq %rsi
movq %r9,%rax
movq $0,8(%r9)
fstpt (%r9)
leave
ret
#else
pushl %ebp
movl %esp,%ebp
subl $24,%esp
pushl %esi
pushl %ebx
fldt 8(%ebp)
movl 20(%ebp),%ebx
fld %st(0)
fstpt -12(%ebp)
leal -4(%ebp),%ecx
movw -4(%ebp),%dx
andl $32767,%edx
jne L25
fldz
fucompp
fnstsw %ax
andb $68,%ah
xorb $64,%ah
jne L21
movl $0,(%ebx)
fldz
jmp L24
.align 2,0x90
.align 2,0x90
L21:
fldt -12(%ebp)
fadd %st(0),%st
fstpt -12(%ebp)
decl %edx
movw (%ecx),%si
andl $32767,%esi
jne L22
cmpl $-66,%edx
jg L21
L22:
addl %esi,%edx
jmp L19
.align 2,0x90
L25:
fstp %st(0)
L19:
addl $-16382,%edx
movl %edx,(%ebx)
movw (%ecx),%ax
andl $-32768,%eax
orl $16382,%eax
movw %ax,(%ecx)
fldt -12(%ebp)
L24:
leal -32(%ebp),%esp
popl %ebx
popl %esi
leave
ret
#endif

View File

@ -0,0 +1,65 @@
/**
* 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 "ilogbl.S"
.text
#ifdef __x86_64__
.align 8
#else
.align 4
#endif
.globl __MINGW_USYMBOL(ilogbl)
.def __MINGW_USYMBOL(ilogbl); .scl 2; .type 32; .endef
__MINGW_USYMBOL(ilogbl):
#ifdef __x86_64__
fldt (%rcx)
fxam /* Is NaN or +-Inf? */
fstsw %ax
movb $0x45, %dh
andb %ah, %dh
cmpb $0x05, %dh
je 1f /* Is +-Inf, jump. */
fxtract
pushq %rax
fstp %st
fistpl (%rsp)
fwait
popq %rax
ret
1: fstp %st
movl $0x7fffffff, %eax
ret
#else
fldt 4(%esp)
/* I added the following ugly construct because ilogb(+-Inf) is
required to return INT_MAX in ISO C99.
-- jakub@redhat.com. */
fxam /* Is NaN or +-Inf? */
fstsw %ax
movb $0x45, %dh
andb %ah, %dh
cmpb $0x05, %dh
je 1f /* Is +-Inf, jump. */
fxtract
pushl %eax
fstp %st
fistpl (%esp)
fwait
popl %eax
ret
1: fstp %st
movl $0x7fffffff, %eax
ret
#endif

View File

@ -0,0 +1,66 @@
/**
* 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 "internal_logl.S"
.text
#ifdef __x86_64__
.align 8
#else
.align 4
#endif
one: .double 1.0
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
limit: .double 0.29
.globl __MINGW_USYMBOL(__logl_internal)
.def __MINGW_USYMBOL(__logl_internal); .scl 2; .type 32; .endef
__MINGW_USYMBOL(__logl_internal):
#ifdef __x86_64__
fldln2 // log(2)
fldt (%rdx) // x : log(2)
fld %st // x : x : log(2)
fsubl one(%rip) // x-1 : x : log(2)
fld %st // x-1 : x-1 : x : log(2)
fabs // |x-1| : x-1 : x : log(2)
fcompl limit(%rip) // x-1 : x : log(2)
fnstsw // x-1 : x : log(2)
andb $0x45, %ah
jz 2f
fstp %st(1) // x-1 : log(2)
fyl2xp1 // log(x)
movq %rcx,%rax
movq $0,8(%rcx)
fstpt (%rcx)
ret
2: fstp %st(0) // x : log(2)
fyl2x // log(x)
movq %rcx,%rax
movq $0,8(%rcx)
fstpt (%rcx)
ret
#else
fldln2 // log(2)
fldt 4(%esp) // x : log(2)
fld %st // x : x : log(2)
fsubl one // x-1 : x : log(2)
fld %st // x-1 : x-1 : x : log(2)
fabs // |x-1| : x-1 : x : log(2)
fcompl limit // x-1 : x : log(2)
fnstsw // x-1 : x : log(2)
andb $0x45, %ah
jz 2f
fstp %st(1) // x-1 : log(2)
fyl2xp1 // log(x)
ret
2: fstp %st(0) // x : log(2)
fyl2x // log(x)
ret
#endif

View File

@ -0,0 +1,18 @@
int
isinf (double x)
{
return __builtin_isinf (x);
}
int
isinff (float x)
{
return __builtin_isinf (x);
}
int
isinfl (long double x)
{
return __builtin_isinf (x);
}

View File

@ -0,0 +1,18 @@
int
isnan (double x)
{
return __builtin_isnan (x);
}
int
isnanf (float x)
{
return __builtin_isnan (x);
}
int
isnanl (long double x)
{
return __builtin_isnan (x);
}

View File

@ -0,0 +1,23 @@
/**
* 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>
long double ldexpl(long double x, int expn)
{
long double res = 0.0L;
if (!isfinite (x) || x == 0.0L)
return x;
__asm__ __volatile__ ("fscale"
: "=t" (res)
: "0" (x), "u" ((long double) expn));
if (!isfinite (res) || res == 0.0L)
errno = ERANGE;
return res;
}

View File

@ -0,0 +1,342 @@
/**
* 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_mconf.h"
#if UNK
static uLD S[9] = {
{ { -1.193945051381510095614E-3L } },
{ { 7.220599478036909672331E-3L } },
{ { -9.622023360406271645744E-3L } },
{ { -4.219773360705915470089E-2L } },
{ { 1.665386113720805206758E-1L } },
{ { -4.200263503403344054473E-2L } },
{ { -6.558780715202540684668E-1L } },
{ { 5.772156649015328608253E-1L } },
{ { 1.000000000000000000000E0L } }
};
#endif
#if IBMPC
static const uLD S[] = {
{ { 0xbaeb,0xd6d3,0x25e5,0x9c7e,0xbff5, 0, 0, 0 } },
{ { 0xfe9a,0xceb4,0xc74e,0xec9a,0x3ff7, 0, 0, 0 } },
{ { 0x9225,0xdfef,0xb0e9,0x9da5,0xbff8, 0, 0, 0 } },
{ { 0x10b0,0xec17,0x87dc,0xacd7,0xbffa, 0, 0, 0 } },
{ { 0x6b8d,0x7515,0x1905,0xaa89,0x3ffc, 0, 0, 0 } },
{ { 0xf183,0x126b,0xf47d,0xac0a,0xbffa, 0, 0, 0 } },
{ { 0x7bf6,0x57d1,0xa013,0xa7e7,0xbffe, 0, 0, 0 } },
{ { 0xc7a9,0x7db0,0x67e3,0x93c4,0x3ffe, 0, 0, 0 } },
{ { 0x0000,0x0000,0x0000,0x8000,0x3fff, 0, 0, 0 } }
};
#endif
#if MIEEE
static uLD S[27] = {
{ { 0xbff50000,0x9c7e25e5,0xd6d3baeb, 0 } },
{ { 0x3ff70000,0xec9ac74e,0xceb4fe9a, 0 } },
{ { 0xbff80000,0x9da5b0e9,0xdfef9225, 0 } },
{ { 0xbffa0000,0xacd787dc,0xec1710b0, 0 } },
{ { 0x3ffc0000,0xaa891905,0x75156b8d, 0 } },
{ { 0xbffa0000,0xac0af47d,0x126bf183, 0 } },
{ { 0xbffe0000,0xa7e7a013,0x57d17bf6, 0 } },
{ { 0x3ffe0000,0x93c467e3,0x7db0c7a9, 0 } },
{ { 0x3fff0000,0x80000000,0x00000000, 0 } }
};
#endif
#if UNK
static uLD SN[9] = {
{ { 1.133374167243894382010E-3L } },
{ { 7.220837261893170325704E-3L } },
{ { 9.621911155035976733706E-3L } },
{ { -4.219773343731191721664E-2L } },
{ { -1.665386113944413519335E-1L } },
{ { -4.200263503402112910504E-2L } },
{ { 6.558780715202536547116E-1L } },
{ { 5.772156649015328608727E-1L } },
{ { -1.000000000000000000000E0L } }
};
#endif
#if IBMPC
static const uLD SN[] = {
{ { 0x5dd1,0x02de,0xb9f7,0x948d,0x3ff5, 0, 0, 0 } },
{ { 0x989b,0xdd68,0xc5f1,0xec9c,0x3ff7, 0, 0, 0 } },
{ { 0x2ca1,0x18f0,0x386f,0x9da5,0x3ff8, 0, 0, 0 } },
{ { 0x783f,0x41dd,0x87d1,0xacd7,0xbffa, 0, 0, 0 } },
{ { 0x7a5b,0xd76d,0x1905,0xaa89,0xbffc, 0, 0, 0 } },
{ { 0x7f64,0x1234,0xf47d,0xac0a,0xbffa, 0, 0, 0 } },
{ { 0x5e26,0x57d1,0xa013,0xa7e7,0x3ffe, 0, 0, 0 } },
{ { 0xc7aa,0x7db0,0x67e3,0x93c4,0x3ffe, 0, 0, 0 } },
{ { 0x0000,0x0000,0x0000,0x8000,0xbfff, 0, 0, 0 } }
};
#endif
#if MIEEE
static uLD SN[] = {
{ { 0x3ff50000,0x948db9f7,0x02de5dd1, 0 } },
{ { 0x3ff70000,0xec9cc5f1,0xdd68989b, 0 } },
{ { 0x3ff80000,0x9da5386f,0x18f02ca1, 0 } },
{ { 0xbffa0000,0xacd787d1,0x41dd783f, 0 } },
{ { 0xbffc0000,0xaa891905,0xd76d7a5b, 0 } },
{ { 0xbffa0000,0xac0af47d,0x12347f64, 0 } },
{ { 0x3ffe0000,0xa7e7a013,0x57d15e26, 0 } },
{ { 0x3ffe0000,0x93c467e3,0x7db0c7aa, 0 } },
{ { 0xbfff0000,0x80000000,0x00000000, 0 } }
};
#endif
/* A[]: Stirling's formula expansion of log gamma
* B[], C[]: log gamma function between 2 and 3
*/
/* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x A(1/x^2)
* x >= 8
* Peak relative error 1.51e-21
* Relative spread of error peaks 5.67e-21
*/
#if UNK
static uLD A[7] = {
{ { 4.885026142432270781165E-3L } },
{ { -1.880801938119376907179E-3L } },
{ { 8.412723297322498080632E-4L } },
{ { -5.952345851765688514613E-4L } },
{ { 7.936507795855070755671E-4L } },
{ { -2.777777777750349603440E-3L } },
{ { 8.333333333333331447505E-2L } }
};
#endif
#if IBMPC
static const uLD A[] = {
{ { 0xd984,0xcc08,0x91c2,0xa012,0x3ff7, 0, 0, 0 } },
{ { 0x3d91,0x0304,0x3da1,0xf685,0xbff5, 0, 0, 0 } },
{ { 0x3bdc,0xaad1,0xd492,0xdc88,0x3ff4, 0, 0, 0 } },
{ { 0x8b20,0x9fce,0x844e,0x9c09,0xbff4, 0, 0, 0 } },
{ { 0xf8f2,0x30e5,0x0092,0xd00d,0x3ff4, 0, 0, 0 } },
{ { 0x4d88,0x03a8,0x60b6,0xb60b,0xbff6, 0, 0, 0 } },
{ { 0x9fcc,0xaaaa,0xaaaa,0xaaaa,0x3ffb, 0, 0, 0 } }
};
#endif
#if MIEEE
static uLD A[] = {
{ { 0x3ff70000,0xa01291c2,0xcc08d984, 0 } },
{ { 0xbff50000,0xf6853da1,0x03043d91, 0 } },
{ { 0x3ff40000,0xdc88d492,0xaad13bdc, 0 } },
{ { 0xbff40000,0x9c09844e,0x9fce8b20, 0 } },
{ { 0x3ff40000,0xd00d0092,0x30e5f8f2, 0 } },
{ { 0xbff60000,0xb60b60b6,0x03a84d88, 0 } },
{ { 0x3ffb0000,0xaaaaaaaa,0xaaaa9fcc, 0 } }
};
#endif
/* log gamma(x+2) = x B(x)/C(x)
* 0 <= x <= 1
* Peak relative error 7.16e-22
* Relative spread of error peaks 4.78e-20
*/
#if UNK
static uLD B[7] = {
{ { -2.163690827643812857640E3L } },
{ { -8.723871522843511459790E4L } },
{ { -1.104326814691464261197E6L } },
{ { -6.111225012005214299996E6L } },
{ { -1.625568062543700591014E7L } },
{ { -2.003937418103815175475E7L } },
{ { -8.875666783650703802159E6L } }
};
static uLD C[7] = {
{ { -5.139481484435370143617E2L } },
{ { -3.403570840534304670537E4L } },
{ { -6.227441164066219501697E5L } },
{ { -4.814940379411882186630E6L } },
{ { -1.785433287045078156959E7L } },
{ { -3.138646407656182662088E7L } },
{ { -2.099336717757895876142E7L } }
};
#endif
#if IBMPC
static const uLD B[] = {
{ { 0x9557,0x4995,0x0da1,0x873b,0xc00a, 0, 0, 0 } },
{ { 0xfe44,0x9af8,0x5b8c,0xaa63,0xc00f, 0, 0, 0 } },
{ { 0x5aa8,0x7cf5,0x3684,0x86ce,0xc013, 0, 0, 0 } },
{ { 0x259a,0x258c,0xf206,0xba7f,0xc015, 0, 0, 0 } },
{ { 0xbe18,0x1ca3,0xc0a0,0xf80a,0xc016, 0, 0, 0 } },
{ { 0x168f,0x2c42,0x6717,0x98e3,0xc017, 0, 0, 0 } },
{ { 0x2051,0x9d55,0x92c8,0x876e,0xc016, 0, 0, 0 } }
};
static const uLD C[] = {
{ { 0xaa77,0xcf2f,0xae76,0x807c,0xc008, 0, 0, 0 } },
{ { 0xb280,0x0d74,0xb55a,0x84f3,0xc00e, 0, 0, 0 } },
{ { 0xa505,0xcd30,0x81dc,0x9809,0xc012, 0, 0, 0 } },
{ { 0x3369,0x4246,0xb8c2,0x92f0,0xc015, 0, 0, 0 } },
{ { 0x63cf,0x6aee,0xbe6f,0x8837,0xc017, 0, 0, 0 } },
{ { 0x26bb,0xccc7,0xb009,0xef75,0xc017, 0, 0, 0 } },
{ { 0x462b,0xbae8,0xab96,0xa02a,0xc017, 0, 0, 0 } }
};
#endif
#if MIEEE
static uLD B[] = {
{ { 0xc00a0000,0x873b0da1,0x49959557, 0 } },
{ { 0xc00f0000,0xaa635b8c,0x9af8fe44, 0 } },
{ { 0xc0130000,0x86ce3684,0x7cf55aa8, 0 } },
{ { 0xc0150000,0xba7ff206,0x258c259a, 0 } },
{ { 0xc0160000,0xf80ac0a0,0x1ca3be18, 0 } },
{ { 0xc0170000,0x98e36717,0x2c42168f, 0 } },
{ { 0xc0160000,0x876e92c8,0x9d552051, 0 } }
};
static uLD C[] = {
{ { 0xc0080000,0x807cae76,0xcf2faa77, 0 } },
{ { 0xc00e0000,0x84f3b55a,0x0d74b280, 0 } },
{ { 0xc0120000,0x980981dc,0xcd30a505, 0 } },
{ { 0xc0150000,0x92f0b8c2,0x42463369, 0 } },
{ { 0xc0170000,0x8837be6f,0x6aee63cf, 0 } },
{ { 0xc0170000,0xef75b009,0xccc726bb, 0 } },
{ { 0xc0170000,0xa02aab96,0xbae8462b, 0 } }
};
#endif
/* log( sqrt( 2*pi ) ) */
static const long double LS2PI = 0.91893853320467274178L;
#if defined(__arm__) || defined(_ARM_)
#define MAXLGM 2.035093e36
#else
#define MAXLGM 1.04848146839019521116e+4928L
#endif /* defined(__arm__) || defined(_ARM_) */
/* Logarithm of gamma function */
/* Reentrant version */
long double __lgammal_r(long double x, int* sgngaml);
long double __lgammal_r(long double x, int* sgngaml)
{
long double p, q, w, z, f, nx;
int i;
*sgngaml = 1;
#ifdef NANS
if (isnanl(x))
return(NANL);
#endif
#ifdef INFINITIES
if (!isfinitel(x))
return (INFINITYL);
#endif
if (x < -34.0L)
{
q = -x;
w = __lgammal_r(q, sgngaml); /* note this modifies sgngam! */
p = floorl(q);
if (p == q)
{
lgsing:
_SET_ERRNO(EDOM);
mtherr( "lgammal", SING );
#ifdef INFINITIES
return (INFINITYL);
#else
return (MAXNUML);
#endif
}
i = p;
if ((i & 1) == 0)
*sgngaml = -1;
else
*sgngaml = 1;
z = q - p;
if (z > 0.5L)
{
p += 1.0L;
z = p - q;
}
z = q * sinl(PIL * z);
if (z == 0.0L)
goto lgsing;
/* z = LOGPI - logl( z ) - w; */
z = logl(PIL/z) - w;
return (z);
}
if (x < 13.0L)
{
z = 1.0L;
nx = floorl(x + 0.5L);
f = x - nx;
while (x >= 3.0L)
{
nx -= 1.0L;
x = nx + f;
z *= x;
}
while (x < 2.0L)
{
if (fabsl(x) <= 0.03125)
goto lsmall;
z /= nx + f;
nx += 1.0L;
x = nx + f;
}
if (z < 0.0L)
{
*sgngaml = -1;
z = -z;
}
else
*sgngaml = 1;
if (x == 2.0L)
return ( logl(z) );
x = (nx - 2.0L) + f;
p = x * polevll(x, B, 6) / p1evll(x, C, 7);
return ( logl(z) + p );
}
if (x > MAXLGM)
{
_SET_ERRNO(ERANGE);
mtherr("lgammal", OVERFLOW);
#ifdef INFINITIES
return (*sgngaml * INFINITYL);
#else
return (*sgngaml * MAXNUML);
#endif
}
q = (x - 0.5L) * logl(x) - x + LS2PI;
if (x > 1.0e10L)
return(q);
p = 1.0L/(x*x);
q += polevll(p, A, 6) / x;
return (q);
lsmall:
if (x == 0.0L)
goto lgsing;
if (x < 0.0L)
{
x = -x;
q = z / (x * polevll(x, SN, 8));
}
else
q = z / (x * polevll(x, S, 8));
if (q < 0.0L)
{
*sgngaml = -1;
q = -q;
}
else
*sgngaml = 1;
q = logl(q);
return (q);
}
/* This is the C99 version */
long double lgammal(long double x)
{
return (__lgammal_r (x, &signgam));
}
long double lgammal_r(long double x, int *signp)
{
return (__lgammal_r (x, signp));
}

View File

@ -0,0 +1,18 @@
/**
* 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>
long long llrint (double x)
{
long long retval = 0ll;
#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
__asm__ __volatile__ ("fistpll %0" : "=m" (retval) : "t" (x) : "st");
#else
retval = (long long)x;
#endif
return retval;
}

View File

@ -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.
*/
#include <math.h>
long long llrintf (float x)
{
long long retval = 0ll;
#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
__asm__ __volatile__ ("fistpll %0" : "=m" (retval) : "t" (x) : "st");
#else
retval = (long long)x;
#endif
return retval;
}

View File

@ -0,0 +1,18 @@
/**
* 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>
long long llrintl (long double x)
{
long long retval = 0ll;
#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
__asm__ __volatile__ ("fistpll %0" : "=m" (retval) : "t" (x) : "st");
#else
retval = (long long)x;
#endif
return retval;
}

View File

@ -0,0 +1,38 @@
/**
* 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 <limits.h>
#include <errno.h>
long long
llroundl (long double x)
{
long double res;
if (x >= 0.0L)
{
res = ceill (x);
if (res - x > 0.5L)
res -= 1.0L;
}
else
{
res = ceill (-x);
if (res + x > 0.5L)
res -= 1.0L;
res = -res;
}
if (!isfinite (res)
|| res > (double) LLONG_MAX
|| res < (double) LLONG_MIN)
{
errno = ERANGE;
/* Undefined behaviour, so we could return anything. */
/* return res > 0.0 ? LLONG_MAX : LLONG_MIN; */
}
return (long long) res;
}

View File

@ -0,0 +1,69 @@
/*
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>
extern long double __cdecl __logl_internal (long double);
__FLT_TYPE __cdecl
__FLT_ABI(log) (__FLT_TYPE x)
{
int x_class = fpclassify (x);
if (x_class == FP_ZERO)
{
__FLT_RPT_ERANGE ("log", x, 0.0, -__FLT_HUGE_VAL, 1);
return -__FLT_HUGE_VAL;
}
else if (signbit (x))
{
__FLT_RPT_DOMAIN ("log", x, 0.0, __FLT_NAN);
return __FLT_NAN;
}
else if (x_class == FP_INFINITE)
return __FLT_HUGE_VAL;
else if (x_class == FP_NAN)
return __FLT_NAN;
return (__FLT_TYPE) __logl_internal ((long double) x);
}

Some files were not shown because too many files have changed in this diff Show More