diff options
Diffstat (limited to 'winsup/mingw/mingwex/complex')
-rw-r--r-- | winsup/mingw/mingwex/complex/cabs.c | 7 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/cacos.c | 82 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/cacosh.c | 37 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/casin.c | 48 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/casinh.c | 23 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/catan.c | 49 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/catanh.c | 23 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/ccos.c | 20 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/ccosh.c | 19 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/cexp.c | 19 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/cimag.c | 6 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/clog.c | 19 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/cpow.c | 48 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/cproj.c | 22 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/creal.c | 6 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/csin.c | 21 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/csinh.c | 21 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/csqrt.c | 55 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/ctan.c | 41 | ||||
-rw-r--r-- | winsup/mingw/mingwex/complex/ctanh.c | 44 |
20 files changed, 0 insertions, 610 deletions
diff --git a/winsup/mingw/mingwex/complex/cabs.c b/winsup/mingw/mingwex/complex/cabs.c deleted file mode 100644 index ff547dd6e..000000000 --- a/winsup/mingw/mingwex/complex/cabs.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <math.h> -#include <complex.h> - -double cabs (double complex Z) -{ - return _hypot ( __real__ Z, __imag__ Z); -} diff --git a/winsup/mingw/mingwex/complex/cacos.c b/winsup/mingw/mingwex/complex/cacos.c deleted file mode 100644 index 265cba0d7..000000000 --- a/winsup/mingw/mingwex/complex/cacos.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - cacos.c - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -#if 0 -/* cacos (Z) = -I * clog(Z + I * csqrt(1 - Z * Z)) */ - -double complex cacos (double complex Z) -{ - double complex Res; - double x, y; - - x = __real__ Z; - y = __imag__ Z; - - if (y == 0.0) - { - __real__ Res = acos (x); - __imag__ Res = 0.0; - } - - else - { - double complex ZZ; - /* Z * Z = ((x - y) * (x + y)) + (2.0 * x * y) * I */ - /* caculate 1 - Z * Z */ - __real__ ZZ = 1.0 - (x - y) * (x + y); - __imag__ ZZ = -2.0 * x * y; - - - Res = csqrt(ZZ); - - /* calculate ZZ + I * sqrt (ZZ) */ - - __real__ ZZ = x - __imag__ Res; - __imag__ ZZ = y + __real__ Res; - - ZZ = clog(ZZ); - - /* mult by -I */ - - __real__ Res = __imag__ ZZ; - __imag__ Res = - __real__ ZZ; - } - return Res; -} - -#else - -/* cacos ( Z ) = pi/2 - casin ( Z ) */ - -double complex cacos (double complex Z) -{ - double complex Res = casin (Z); - __real__ Res = M_PI_2 - __real__ Res; - __imag__ Res = - __imag__ Res; - return Res; -} -#endif - -#if 0 -#include <stdio.h> -int main() -{ - double z; - double complex bar = 0.7 + 1.2 * I; - double complex foo = cacos (bar); - - printf ("%.16e\t%.16e\n", __real__ foo, __imag__ foo); - - foo = cacos (bar); - printf ("%.16e\t%.16e\n", __real__ foo, __imag__ foo); - - return 1; -} -#endif - diff --git a/winsup/mingw/mingwex/complex/cacosh.c b/winsup/mingw/mingwex/complex/cacosh.c deleted file mode 100644 index 34469cb56..000000000 --- a/winsup/mingw/mingwex/complex/cacosh.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - cacosh.c - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -#if 0 -/* cacosh (z) = I * cacos (z) */ -double complex cacosh (double complex Z) -{ - double complex Tmp; - double complex Res; - - Tmp = cacos (Z); - __real__ Res = -__imag__ Tmp; - __imag__ Res = __real__ Tmp; - return Res; -} - -#else - -/* cacosh (z) = I * cacos (z) = I * (pi/2 - casin (z)) */ - -double complex cacosh (double complex Z) -{ - double complex Tmp; - double complex Res; - - Tmp = casin (Z); - __real__ Res = __imag__ Tmp; - __imag__ Res = M_PI_2 - __real__ Tmp; - return Res; -} -#endif diff --git a/winsup/mingw/mingwex/complex/casin.c b/winsup/mingw/mingwex/complex/casin.c deleted file mode 100644 index cd79767b5..000000000 --- a/winsup/mingw/mingwex/complex/casin.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - casin.c - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -/* casin (Z ) = -I * clog(I * Z + csqrt (1.0 - Z * Z))) */ - -double complex casin (double complex Z) -{ - double complex Res; - double x, y; - - x = __real__ Z; - y = __imag__ Z; - - if (y == 0.0) - { - __real__ Res = asin (x); - __imag__ Res = 0.0; - } - else /* -I * clog(I * Z + csqrt(1.0 - Z * Z))) */ - { - double complex ZZ; - - /* Z * Z = ((x - y) * (x + y)) + (2.0 * x * y) * I */ - /* calculate 1 - Z * Z */ - __real__ ZZ = 1.0 - (x - y) * (x + y); - __imag__ ZZ = -2.0 * x * y; - ZZ = csqrt (ZZ); - - - /* add I * Z to ZZ */ - - __real__ ZZ -= y; - __imag__ ZZ += x; - - ZZ = clog (ZZ); - - /* mult by -I */ - __real__ Res = __imag__ ZZ; - __imag__ Res = - __real__ ZZ; - } - return (Res); -} diff --git a/winsup/mingw/mingwex/complex/casinh.c b/winsup/mingw/mingwex/complex/casinh.c deleted file mode 100644 index a86c1d625..000000000 --- a/winsup/mingw/mingwex/complex/casinh.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - casinh.c - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -/* casinh (z) = -I casin (I * z) */ - -double complex casinh (double complex Z) -{ - double complex Tmp; - double complex Res; - - __real__ Tmp = - __imag__ Z; - __imag__ Tmp = __real__ Z; - Tmp = casin (Tmp); - __real__ Res = __imag__ Tmp; - __imag__ Res = - __real__ Tmp; - return Res; -} diff --git a/winsup/mingw/mingwex/complex/catan.c b/winsup/mingw/mingwex/complex/catan.c deleted file mode 100644 index eee1e8fa7..000000000 --- a/winsup/mingw/mingwex/complex/catan.c +++ /dev/null @@ -1,49 +0,0 @@ -/* catan.c */ - -/* - Contributed by Danny Smith - 2003-10-17 - - FIXME: This needs some serious numerical analysis. -*/ - -#include <math.h> -#include <complex.h> -#include <errno.h> - -/* catan (z) = -I/2 * clog ((I + z) / (I - z)) */ - -double complex -catan (double complex Z) -{ - double complex Res; - double complex Tmp; - double x = __real__ Z; - double y = __imag__ Z; - - if ( x == 0.0 && (1.0 - fabs (y)) == 0.0) - { - errno = ERANGE; - __real__ Res = HUGE_VAL; - __imag__ Res = HUGE_VAL; - } - else if (isinf (_hypot (x, y))) - { - __real__ Res = (x > 0 ? M_PI_2 : -M_PI_2); - __imag__ Res = 0.0; - } - else - { - __real__ Tmp = - x; - __imag__ Tmp = 1.0 - y; - - __real__ Res = x; - __imag__ Res = y + 1.0; - - Tmp = clog (Res/Tmp); - __real__ Res = - 0.5 * __imag__ Tmp; - __imag__ Res = 0.5 * __real__ Tmp; - } - - return Res; -} diff --git a/winsup/mingw/mingwex/complex/catanh.c b/winsup/mingw/mingwex/complex/catanh.c deleted file mode 100644 index 78f028014..000000000 --- a/winsup/mingw/mingwex/complex/catanh.c +++ /dev/null @@ -1,23 +0,0 @@ -/* catanh.c */ -/* - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -/* catanh (z) = -I * catan (I * z) */ - -double complex catanh (double complex Z) -{ - double complex Tmp; - double complex Res; - - __real__ Tmp = - __imag__ Z; - __imag__ Tmp = __real__ Z; - Tmp = catan (Tmp); - __real__ Res = __imag__ Tmp; - __imag__ Res = - __real__ Tmp; - return Res; -} diff --git a/winsup/mingw/mingwex/complex/ccos.c b/winsup/mingw/mingwex/complex/ccos.c deleted file mode 100644 index ef5b5a70e..000000000 --- a/winsup/mingw/mingwex/complex/ccos.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - ccos.c - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -/* ccos (x + I * y) = cos (x) * cosh (y) - + I * (sin (x) * sinh (y)) */ - - -double complex ccos (double complex Z) -{ - double complex Res; - __real__ Res = cos (__real__ Z) * cosh ( __imag__ Z); - __imag__ Res = -sin (__real__ Z) * sinh ( __imag__ Z); - return Res; -} diff --git a/winsup/mingw/mingwex/complex/ccosh.c b/winsup/mingw/mingwex/complex/ccosh.c deleted file mode 100644 index 8d304fd0e..000000000 --- a/winsup/mingw/mingwex/complex/ccosh.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - ccosh.c - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -/* ccosh (x + I * y) = cosh (x) * cos (y) - + I * (sinh (x) * sin (y)) */ - -double complex ccosh (double complex Z) -{ - double complex Res; - __real__ Res = cosh (__real__ Z) * cos (__imag__ Z); - __imag__ Res = sinh (__real__ Z) * sin (__imag__ Z); - return Res; -} diff --git a/winsup/mingw/mingwex/complex/cexp.c b/winsup/mingw/mingwex/complex/cexp.c deleted file mode 100644 index 43ac9ab9e..000000000 --- a/winsup/mingw/mingwex/complex/cexp.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - cexp.c - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -/* cexp (x + I * y) = exp (x) * cos (y) + I * exp (x) * sin (y) */ - -double complex cexp (double complex Z) -{ - double complex Res; - long double rho = exp (__real__ Z); - __real__ Res = rho * cos(__imag__ Z); - __imag__ Res = rho * sin(__imag__ Z); - return Res; -} diff --git a/winsup/mingw/mingwex/complex/cimag.c b/winsup/mingw/mingwex/complex/cimag.c deleted file mode 100644 index b6b32561c..000000000 --- a/winsup/mingw/mingwex/complex/cimag.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <complex.h> -double __attribute__ ((const)) cimag (double complex _Z) -{ - return __imag__ _Z; -} - diff --git a/winsup/mingw/mingwex/complex/clog.c b/winsup/mingw/mingwex/complex/clog.c deleted file mode 100644 index 57c51ebb0..000000000 --- a/winsup/mingw/mingwex/complex/clog.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - clog.c - Contributed by Danny Smith - 2003-10-20 -*/ - -/* clog (x + I * y) = log (hypot (x, y)) + I * atan2 (y, x) */ - -#include <math.h> -#include <complex.h> - -double complex clog (double complex Z) -{ - double complex Res; - __real__ Res = log (_hypot (__real__ Z, __imag__ Z)); - __imag__ Res = carg (Z); - return Res; -} - diff --git a/winsup/mingw/mingwex/complex/cpow.c b/winsup/mingw/mingwex/complex/cpow.c deleted file mode 100644 index c12b12fc0..000000000 --- a/winsup/mingw/mingwex/complex/cpow.c +++ /dev/null @@ -1,48 +0,0 @@ -/* cpow.c */ -/* - Contributed by Danny Smith - 2003-10-20 -*/ - -/* cpow(X, Y) = cexp(X * clog(Y)) */ - -#include <math.h> -#include <complex.h> - -/* Use dll version of pow */ -extern double (*_imp__pow) (double, double); -#define pow (*_imp__pow) - -double complex cpow (double complex X, double complex Y) -{ - double complex Res; - double i; - double r = hypot (__real__ X, __imag__ X); - if (r == 0.0) - { - __real__ Res = __imag__ Res = 0.0; - } - else - { - double rho; - double theta; - i = carg (X); - theta = i * __real__ Y; - - if (__imag__ Y == 0.0) - /* This gives slightly more accurate results in these cases. */ - rho = pow (r, __real__ Y); - else - { - r = log (r); - /* rearrangement of cexp(X * clog(Y)) */ - theta += r * __imag__ Y; - rho = exp (r * __real__ Y - i * __imag__ Y); - } - - __real__ Res = rho * cos (theta); - __imag__ Res = rho * sin (theta); - } - return Res; -} - diff --git a/winsup/mingw/mingwex/complex/cproj.c b/winsup/mingw/mingwex/complex/cproj.c deleted file mode 100644 index cc7c48d0f..000000000 --- a/winsup/mingw/mingwex/complex/cproj.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - cproj.c - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -/* Return the value of the projection onto the Riemann sphere.*/ - -double complex cproj (double complex Z) -{ - complex double Res = Z; - if (isinf (__real__ Z) || isinf (__imag__ Z)) - { - __real__ Res = HUGE_VAL; - __imag__ Res = copysign (0.0, __imag__ Z); - } - return Res; -} - diff --git a/winsup/mingw/mingwex/complex/creal.c b/winsup/mingw/mingwex/complex/creal.c deleted file mode 100644 index 6905b7e2a..000000000 --- a/winsup/mingw/mingwex/complex/creal.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <complex.h> -double __attribute__ ((const)) creal (double complex _Z) -{ - return __real__ _Z; -} - diff --git a/winsup/mingw/mingwex/complex/csin.c b/winsup/mingw/mingwex/complex/csin.c deleted file mode 100644 index 37df8057e..000000000 --- a/winsup/mingw/mingwex/complex/csin.c +++ /dev/null @@ -1,21 +0,0 @@ -/* csin.c */ - -/* - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -/* csin (x + I * y) = sin (x) * cosh (y) - + I * (cos (x) * sinh (y)) */ - -double complex csin (double complex Z) -{ - double complex Res; - __real__ Res = sin (__real__ Z) * cosh ( __imag__ Z); - __imag__ Res = cos (__real__ Z) * sinh ( __imag__ Z); - return Res; -} - diff --git a/winsup/mingw/mingwex/complex/csinh.c b/winsup/mingw/mingwex/complex/csinh.c deleted file mode 100644 index 4ee6cbe86..000000000 --- a/winsup/mingw/mingwex/complex/csinh.c +++ /dev/null @@ -1,21 +0,0 @@ -/* csinh.c */ -/* - Contributed by Danny Smith - 2003-10-20 -*/ - - -#include <math.h> -#include <complex.h> - -/* csinh (x + I * y) = sinh (x) * cos (y) - + I * (cosh (x) * sin (y)) */ - - -double complex csinh (double complex Z) -{ - double complex Res; - __real__ Res = sinh (__real__ Z) * cos (__imag__ Z); - __imag__ Res = cosh (__real__ Z) * sin (__imag__ Z); - return Res; -} diff --git a/winsup/mingw/mingwex/complex/csqrt.c b/winsup/mingw/mingwex/complex/csqrt.c deleted file mode 100644 index 3717939f4..000000000 --- a/winsup/mingw/mingwex/complex/csqrt.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - csqrt.c - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> - -double complex csqrt (double complex Z) -{ - double complex Res; - double t; - double x = __real__ Z; - double y = __imag__ Z; - - if (y == 0.0) - { - if (x < 0.0) - { - __real__ Res = 0.0; - __imag__ Res = sqrt (-x); - } - else - { - __real__ Res = sqrt (x); - __imag__ Res = 0.0; - } - } - - else if (x == 0.0) - { - t = sqrt(0.5 * fabs (y)); - __real__ Res = y > 0 ? t : -t; - __imag__ Res = t; - } - - else - { - t = sqrt (2.0 * (_hypot (x, y) + fabs (x))); - if ( x > 0.0) - { - __real__ Res = 0.5 * t; - __imag__ Res = y / t; - } - else - { - __real__ Res = fabs ( y / t); - __imag__ Res = (y < 0.0 ? -0.5 : 0.5) * t; - } - } - - return Res; -} - diff --git a/winsup/mingw/mingwex/complex/ctan.c b/winsup/mingw/mingwex/complex/ctan.c deleted file mode 100644 index a479772a9..000000000 --- a/winsup/mingw/mingwex/complex/ctan.c +++ /dev/null @@ -1,41 +0,0 @@ -/* ctan.c */ - -/* - Contributed by Danny Smith - 2003-10-20 -*/ - -#include <math.h> -#include <complex.h> -#include <errno.h> - - -/* ctan (x + I * y) = (sin (2 * x) + I * sinh(2 * y)) - / (cos (2 * x) + cosh (2 * y)) */ - -double complex ctan (double complex Z) -{ - double complex Res; - double two_I = 2.0 * __imag__ Z; - double two_R = 2.0 * __real__ Z; - double denom = cos (two_R) + cosh (two_I); - if (denom == 0.0) - { - errno = ERANGE; - __real__ Res = HUGE_VAL; - __imag__ Res = HUGE_VAL; - } - else if (isinf (denom)) - { - errno = ERANGE; - __real__ Res = 0.0; - __imag__ Res = two_I > 0 ? 1.0 : -1.0; - } - else - { - __real__ Res = sin (two_R) / denom; - __imag__ Res = sinh (two_I) / denom; - } - return Res; -} - diff --git a/winsup/mingw/mingwex/complex/ctanh.c b/winsup/mingw/mingwex/complex/ctanh.c deleted file mode 100644 index 6d3e615da..000000000 --- a/winsup/mingw/mingwex/complex/ctanh.c +++ /dev/null @@ -1,44 +0,0 @@ -/* ctanh.c */ - -/* - Contributed by Danny Smith - 2003-10-20 -*/ - - -#include <math.h> -#include <complex.h> -#include <errno.h> - -/* - ctanh (x + I * y) = (sinh (2 * x) + sin (2 * y) * I ) - / (cosh (2 * x) + cos (2 * y)) . -*/ - -double complex -ctanh (double complex Z) -{ - double complex Res; - double two_R = 2.0 * __real__ Z; - double two_I = 2.0 * __imag__ Z; - double denom = cosh (two_R) + cos (two_I); - - if (denom == 0.0) - { - errno = ERANGE; - __real__ Res = HUGE_VAL; - __imag__ Res = HUGE_VAL; - } - else if ( isinf (denom)) - { - errno = ERANGE; - __real__ Res = two_R > 0 ? 1.0 : -1.0; - __imag__ Res = 0.0; - } - else - { - __real__ Res = sinh (two_R) / denom; - __imag__ Res = sin (two_I) / denom; - } - return Res; -} |