From 2d72b58070bc43a727b580a46746e87215a60a33 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Thu, 29 Nov 2018 22:09:53 +0000 Subject: [PATCH] math: move complex math out of libm.h This makes it easier to build musl math code with a compiler that does not support complex types (tcc) and in general more sensible factorization of the internal headers. --- src/complex/__cexp.c | 2 +- src/complex/__cexpf.c | 2 +- src/complex/cabs.c | 2 +- src/complex/cabsf.c | 2 +- src/complex/cabsl.c | 2 +- src/complex/cacos.c | 2 +- src/complex/cacosf.c | 2 +- src/complex/cacosh.c | 2 +- src/complex/cacoshf.c | 2 +- src/complex/cacoshl.c | 2 +- src/complex/cacosl.c | 2 +- src/complex/carg.c | 2 +- src/complex/cargf.c | 2 +- src/complex/cargl.c | 2 +- src/complex/casin.c | 2 +- src/complex/casinf.c | 2 +- src/complex/casinh.c | 2 +- src/complex/casinhf.c | 2 +- src/complex/casinhl.c | 2 +- src/complex/casinl.c | 2 +- src/complex/catan.c | 2 +- src/complex/catanf.c | 2 +- src/complex/catanh.c | 2 +- src/complex/catanhf.c | 2 +- src/complex/catanhl.c | 2 +- src/complex/catanl.c | 2 +- src/complex/ccos.c | 2 +- src/complex/ccosf.c | 2 +- src/complex/ccosh.c | 2 +- src/complex/ccoshf.c | 2 +- src/complex/ccoshl.c | 2 +- src/complex/ccosl.c | 2 +- src/complex/cexp.c | 2 +- src/complex/cexpf.c | 2 +- src/complex/cexpl.c | 2 +- src/complex/cimag.c | 2 +- src/complex/cimagf.c | 2 +- src/complex/cimagl.c | 2 +- src/complex/clog.c | 2 +- src/complex/clogf.c | 2 +- src/complex/clogl.c | 2 +- src/complex/conj.c | 2 +- src/complex/conjf.c | 2 +- src/complex/conjl.c | 2 +- src/complex/cpow.c | 2 +- src/complex/cpowf.c | 2 +- src/complex/cpowl.c | 2 +- src/complex/cproj.c | 2 +- src/complex/cprojf.c | 2 +- src/complex/cprojl.c | 2 +- src/complex/csin.c | 2 +- src/complex/csinf.c | 2 +- src/complex/csinh.c | 2 +- src/complex/csinhf.c | 2 +- src/complex/csinhl.c | 2 +- src/complex/csinl.c | 2 +- src/complex/csqrt.c | 2 +- src/complex/csqrtf.c | 2 +- src/complex/csqrtl.c | 2 +- src/complex/ctan.c | 2 +- src/complex/ctanf.c | 2 +- src/complex/ctanh.c | 2 +- src/complex/ctanhf.c | 2 +- src/complex/ctanhl.c | 2 +- src/complex/ctanl.c | 2 +- src/internal/complex_impl.h | 22 ++++++++++++++++++++++ src/internal/libm.h | 15 --------------- 67 files changed, 87 insertions(+), 80 deletions(-) create mode 100644 src/internal/complex_impl.h diff --git a/src/complex/__cexp.c b/src/complex/__cexp.c index 05ac28c7..003d20af 100644 --- a/src/complex/__cexp.c +++ b/src/complex/__cexp.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -#include "libm.h" +#include "complex_impl.h" static const uint32_t k = 1799; /* constant for reduction */ static const double kln2 = 1246.97177782734161156; /* k * ln2 */ diff --git a/src/complex/__cexpf.c b/src/complex/__cexpf.c index 69b54045..ee5ff2bc 100644 --- a/src/complex/__cexpf.c +++ b/src/complex/__cexpf.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -#include "libm.h" +#include "complex_impl.h" static const uint32_t k = 235; /* constant for reduction */ static const float kln2 = 162.88958740F; /* k * ln2 */ diff --git a/src/complex/cabs.c b/src/complex/cabs.c index f61d364e..c5ad58ab 100644 --- a/src/complex/cabs.c +++ b/src/complex/cabs.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" double cabs(double complex z) { diff --git a/src/complex/cabsf.c b/src/complex/cabsf.c index 30b25c70..619f28d3 100644 --- a/src/complex/cabsf.c +++ b/src/complex/cabsf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float cabsf(float complex z) { diff --git a/src/complex/cabsl.c b/src/complex/cabsl.c index 40a067c1..d37e3f2e 100644 --- a/src/complex/cabsl.c +++ b/src/complex/cabsl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double cabsl(long double complex z) diff --git a/src/complex/cacos.c b/src/complex/cacos.c index 27c35636..c39d257b 100644 --- a/src/complex/cacos.c +++ b/src/complex/cacos.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" // FIXME: Hull et al. "Implementing the complex arcsine and arccosine functions using exception handling" 1997 diff --git a/src/complex/cacosf.c b/src/complex/cacosf.c index 11852659..2e048540 100644 --- a/src/complex/cacosf.c +++ b/src/complex/cacosf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" // FIXME diff --git a/src/complex/cacosh.c b/src/complex/cacosh.c index 8c68cb01..8e42f1ae 100644 --- a/src/complex/cacosh.c +++ b/src/complex/cacosh.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" /* acosh(z) = i acos(z) */ diff --git a/src/complex/cacoshf.c b/src/complex/cacoshf.c index ade01c09..d7e6b545 100644 --- a/src/complex/cacoshf.c +++ b/src/complex/cacoshf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float complex cacoshf(float complex z) { diff --git a/src/complex/cacoshl.c b/src/complex/cacoshl.c index 65342557..d3eaee20 100644 --- a/src/complex/cacoshl.c +++ b/src/complex/cacoshl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex cacoshl(long double complex z) diff --git a/src/complex/cacosl.c b/src/complex/cacosl.c index 7fd4a2f6..cc20dcd7 100644 --- a/src/complex/cacosl.c +++ b/src/complex/cacosl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex cacosl(long double complex z) diff --git a/src/complex/carg.c b/src/complex/carg.c index d2d1b462..dfe9b97a 100644 --- a/src/complex/carg.c +++ b/src/complex/carg.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" double carg(double complex z) { diff --git a/src/complex/cargf.c b/src/complex/cargf.c index ce183c4b..9a6c19b6 100644 --- a/src/complex/cargf.c +++ b/src/complex/cargf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float cargf(float complex z) { diff --git a/src/complex/cargl.c b/src/complex/cargl.c index e0d50478..88f95f96 100644 --- a/src/complex/cargl.c +++ b/src/complex/cargl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double cargl(long double complex z) diff --git a/src/complex/casin.c b/src/complex/casin.c index 01ed6184..3244bebb 100644 --- a/src/complex/casin.c +++ b/src/complex/casin.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" // FIXME diff --git a/src/complex/casinf.c b/src/complex/casinf.c index 4fcb76fc..2cda2f08 100644 --- a/src/complex/casinf.c +++ b/src/complex/casinf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" // FIXME diff --git a/src/complex/casinh.c b/src/complex/casinh.c index b57fe8c4..50bf27ce 100644 --- a/src/complex/casinh.c +++ b/src/complex/casinh.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" /* asinh(z) = -i asin(i z) */ diff --git a/src/complex/casinhf.c b/src/complex/casinhf.c index a11bf902..93d82e5f 100644 --- a/src/complex/casinhf.c +++ b/src/complex/casinhf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float complex casinhf(float complex z) { diff --git a/src/complex/casinhl.c b/src/complex/casinhl.c index 714f1893..68ba3ddf 100644 --- a/src/complex/casinhl.c +++ b/src/complex/casinhl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex casinhl(long double complex z) diff --git a/src/complex/casinl.c b/src/complex/casinl.c index 3b7ceba7..072adc45 100644 --- a/src/complex/casinl.c +++ b/src/complex/casinl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex casinl(long double complex z) diff --git a/src/complex/catan.c b/src/complex/catan.c index 7dc2afeb..ccc2fb53 100644 --- a/src/complex/catan.c +++ b/src/complex/catan.c @@ -58,7 +58,7 @@ * 2.9e-17. See also clog(). */ -#include "libm.h" +#include "complex_impl.h" #define MAXNUM 1.0e308 diff --git a/src/complex/catanf.c b/src/complex/catanf.c index 8533bde3..e10d9c09 100644 --- a/src/complex/catanf.c +++ b/src/complex/catanf.c @@ -53,7 +53,7 @@ * IEEE -10,+10 30000 2.3e-6 5.2e-8 */ -#include "libm.h" +#include "complex_impl.h" #define MAXNUMF 1.0e38F diff --git a/src/complex/catanh.c b/src/complex/catanh.c index e248d9b9..c324c7f2 100644 --- a/src/complex/catanh.c +++ b/src/complex/catanh.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" /* atanh = -i atan(i z) */ diff --git a/src/complex/catanhf.c b/src/complex/catanhf.c index 4a5eb040..b0505f60 100644 --- a/src/complex/catanhf.c +++ b/src/complex/catanhf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float complex catanhf(float complex z) { diff --git a/src/complex/catanhl.c b/src/complex/catanhl.c index a5dd538e..6025c414 100644 --- a/src/complex/catanhl.c +++ b/src/complex/catanhl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex catanhl(long double complex z) diff --git a/src/complex/catanl.c b/src/complex/catanl.c index 5ace7704..a9fc02db 100644 --- a/src/complex/catanl.c +++ b/src/complex/catanl.c @@ -59,7 +59,7 @@ #include #include -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex catanl(long double complex z) diff --git a/src/complex/ccos.c b/src/complex/ccos.c index 645aec29..f32e1fad 100644 --- a/src/complex/ccos.c +++ b/src/complex/ccos.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" /* cos(z) = cosh(i z) */ diff --git a/src/complex/ccosf.c b/src/complex/ccosf.c index 9a67241f..490be9b3 100644 --- a/src/complex/ccosf.c +++ b/src/complex/ccosf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float complex ccosf(float complex z) { diff --git a/src/complex/ccosh.c b/src/complex/ccosh.c index 401f3c60..c995da7b 100644 --- a/src/complex/ccosh.c +++ b/src/complex/ccosh.c @@ -34,7 +34,7 @@ * These values and the return value were taken from n1124.pdf. */ -#include "libm.h" +#include "complex_impl.h" static const double huge = 0x1p1023; diff --git a/src/complex/ccoshf.c b/src/complex/ccoshf.c index 90acfe05..189ce946 100644 --- a/src/complex/ccoshf.c +++ b/src/complex/ccoshf.c @@ -28,7 +28,7 @@ * Hyperbolic cosine of a complex argument. See s_ccosh.c for details. */ -#include "libm.h" +#include "complex_impl.h" static const float huge = 0x1p127; diff --git a/src/complex/ccoshl.c b/src/complex/ccoshl.c index 9b2aed9e..ffb4d8a1 100644 --- a/src/complex/ccoshl.c +++ b/src/complex/ccoshl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" //FIXME long double complex ccoshl(long double complex z) diff --git a/src/complex/ccosl.c b/src/complex/ccosl.c index d787047f..2530006b 100644 --- a/src/complex/ccosl.c +++ b/src/complex/ccosl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex ccosl(long double complex z) diff --git a/src/complex/cexp.c b/src/complex/cexp.c index 5118e00e..7fb489bb 100644 --- a/src/complex/cexp.c +++ b/src/complex/cexp.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -#include "libm.h" +#include "complex_impl.h" static const uint32_t exp_ovfl = 0x40862e42, /* high bits of MAX_EXP * ln2 ~= 710 */ diff --git a/src/complex/cexpf.c b/src/complex/cexpf.c index 1a09964c..00d258f3 100644 --- a/src/complex/cexpf.c +++ b/src/complex/cexpf.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -#include "libm.h" +#include "complex_impl.h" static const uint32_t exp_ovfl = 0x42b17218, /* MAX_EXP * ln2 ~= 88.722839355 */ diff --git a/src/complex/cexpl.c b/src/complex/cexpl.c index a27f85c0..d4df950e 100644 --- a/src/complex/cexpl.c +++ b/src/complex/cexpl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" //FIXME long double complex cexpl(long double complex z) diff --git a/src/complex/cimag.c b/src/complex/cimag.c index 00955641..d6b0e683 100644 --- a/src/complex/cimag.c +++ b/src/complex/cimag.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" double (cimag)(double complex z) { diff --git a/src/complex/cimagf.c b/src/complex/cimagf.c index f7bcd76e..b7166dcf 100644 --- a/src/complex/cimagf.c +++ b/src/complex/cimagf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float (cimagf)(float complex z) { diff --git a/src/complex/cimagl.c b/src/complex/cimagl.c index 9ec24eee..4db77f20 100644 --- a/src/complex/cimagl.c +++ b/src/complex/cimagl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" long double (cimagl)(long double complex z) { diff --git a/src/complex/clog.c b/src/complex/clog.c index 12aae9c7..b587c291 100644 --- a/src/complex/clog.c +++ b/src/complex/clog.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" // FIXME diff --git a/src/complex/clogf.c b/src/complex/clogf.c index e9b32e60..0389d472 100644 --- a/src/complex/clogf.c +++ b/src/complex/clogf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" // FIXME diff --git a/src/complex/clogl.c b/src/complex/clogl.c index 18f16088..88e83e87 100644 --- a/src/complex/clogl.c +++ b/src/complex/clogl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex clogl(long double complex z) diff --git a/src/complex/conj.c b/src/complex/conj.c index 0b3f5f46..a3b19a4a 100644 --- a/src/complex/conj.c +++ b/src/complex/conj.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" double complex conj(double complex z) { diff --git a/src/complex/conjf.c b/src/complex/conjf.c index 9af6b2c3..b2195c84 100644 --- a/src/complex/conjf.c +++ b/src/complex/conjf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float complex conjf(float complex z) { diff --git a/src/complex/conjl.c b/src/complex/conjl.c index 67f11b9d..87a4ebec 100644 --- a/src/complex/conjl.c +++ b/src/complex/conjl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" long double complex conjl(long double complex z) { diff --git a/src/complex/cpow.c b/src/complex/cpow.c index f863588f..1137d391 100644 --- a/src/complex/cpow.c +++ b/src/complex/cpow.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" /* pow(z, c) = exp(c log(z)), See C99 G.6.4.1 */ diff --git a/src/complex/cpowf.c b/src/complex/cpowf.c index 53c65dcb..f3fd4b7b 100644 --- a/src/complex/cpowf.c +++ b/src/complex/cpowf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float complex cpowf(float complex z, float complex c) { diff --git a/src/complex/cpowl.c b/src/complex/cpowl.c index c1a80a7b..be36f046 100644 --- a/src/complex/cpowl.c +++ b/src/complex/cpowl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex cpowl(long double complex z, long double complex c) diff --git a/src/complex/cproj.c b/src/complex/cproj.c index 15f358a1..9ae1e17c 100644 --- a/src/complex/cproj.c +++ b/src/complex/cproj.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" double complex cproj(double complex z) { diff --git a/src/complex/cprojf.c b/src/complex/cprojf.c index 653be5e8..03fab339 100644 --- a/src/complex/cprojf.c +++ b/src/complex/cprojf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float complex cprojf(float complex z) { diff --git a/src/complex/cprojl.c b/src/complex/cprojl.c index 6731aaa2..38a494c5 100644 --- a/src/complex/cprojl.c +++ b/src/complex/cprojl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex cprojl(long double complex z) diff --git a/src/complex/csin.c b/src/complex/csin.c index ad8ae67a..535c4bf8 100644 --- a/src/complex/csin.c +++ b/src/complex/csin.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" /* sin(z) = -i sinh(i z) */ diff --git a/src/complex/csinf.c b/src/complex/csinf.c index 60b3cbaa..69f5164e 100644 --- a/src/complex/csinf.c +++ b/src/complex/csinf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float complex csinf(float complex z) { diff --git a/src/complex/csinh.c b/src/complex/csinh.c index 0f8035d1..eda0ab59 100644 --- a/src/complex/csinh.c +++ b/src/complex/csinh.c @@ -34,7 +34,7 @@ * These values and the return value were taken from n1124.pdf. */ -#include "libm.h" +#include "complex_impl.h" static const double huge = 0x1p1023; diff --git a/src/complex/csinhf.c b/src/complex/csinhf.c index 49697f02..eb1d98c5 100644 --- a/src/complex/csinhf.c +++ b/src/complex/csinhf.c @@ -28,7 +28,7 @@ * Hyperbolic sine of a complex argument z. See s_csinh.c for details. */ -#include "libm.h" +#include "complex_impl.h" static const float huge = 0x1p127; diff --git a/src/complex/csinhl.c b/src/complex/csinhl.c index c566653b..09fd18f9 100644 --- a/src/complex/csinhl.c +++ b/src/complex/csinhl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" //FIXME long double complex csinhl(long double complex z) diff --git a/src/complex/csinl.c b/src/complex/csinl.c index 4e9f86c3..90a4eb37 100644 --- a/src/complex/csinl.c +++ b/src/complex/csinl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex csinl(long double complex z) diff --git a/src/complex/csqrt.c b/src/complex/csqrt.c index 8a2ba608..c36de001 100644 --- a/src/complex/csqrt.c +++ b/src/complex/csqrt.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -#include "libm.h" +#include "complex_impl.h" /* * gcc doesn't implement complex multiplication or division correctly, diff --git a/src/complex/csqrtf.c b/src/complex/csqrtf.c index ab5102f0..a6163974 100644 --- a/src/complex/csqrtf.c +++ b/src/complex/csqrtf.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -#include "libm.h" +#include "complex_impl.h" /* * gcc doesn't implement complex multiplication or division correctly, diff --git a/src/complex/csqrtl.c b/src/complex/csqrtl.c index 0600ef3b..22539379 100644 --- a/src/complex/csqrtl.c +++ b/src/complex/csqrtl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" //FIXME long double complex csqrtl(long double complex z) diff --git a/src/complex/ctan.c b/src/complex/ctan.c index c0926374..918717bf 100644 --- a/src/complex/ctan.c +++ b/src/complex/ctan.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" /* tan(z) = -i tanh(i z) */ diff --git a/src/complex/ctanf.c b/src/complex/ctanf.c index 009b1921..04c3ff19 100644 --- a/src/complex/ctanf.c +++ b/src/complex/ctanf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" float complex ctanf(float complex z) { diff --git a/src/complex/ctanh.c b/src/complex/ctanh.c index 3ba3a899..54004cd7 100644 --- a/src/complex/ctanh.c +++ b/src/complex/ctanh.c @@ -63,7 +63,7 @@ * precision. I also handle large x differently. */ -#include "libm.h" +#include "complex_impl.h" double complex ctanh(double complex z) { diff --git a/src/complex/ctanhf.c b/src/complex/ctanhf.c index 72b76da0..7f422ba7 100644 --- a/src/complex/ctanhf.c +++ b/src/complex/ctanhf.c @@ -28,7 +28,7 @@ * Hyperbolic tangent of a complex argument z. See s_ctanh.c for details. */ -#include "libm.h" +#include "complex_impl.h" float complex ctanhf(float complex z) { diff --git a/src/complex/ctanhl.c b/src/complex/ctanhl.c index 89a75d13..45d5862c 100644 --- a/src/complex/ctanhl.c +++ b/src/complex/ctanhl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" //FIXME long double complex ctanhl(long double complex z) diff --git a/src/complex/ctanl.c b/src/complex/ctanl.c index ac1c3e0a..4b87420d 100644 --- a/src/complex/ctanl.c +++ b/src/complex/ctanl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include "complex_impl.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double complex ctanl(long double complex z) diff --git a/src/internal/complex_impl.h b/src/internal/complex_impl.h new file mode 100644 index 00000000..51fb298a --- /dev/null +++ b/src/internal/complex_impl.h @@ -0,0 +1,22 @@ +#ifndef _COMPLEX_IMPL_H +#define _COMPLEX_IMPL_H + +#include +#include "libm.h" + +#undef __CMPLX +#undef CMPLX +#undef CMPLXF +#undef CMPLXL + +#define __CMPLX(x, y, t) \ + ((union { _Complex t __z; t __xy[2]; }){.__xy = {(x),(y)}}.__z) + +#define CMPLX(x, y) __CMPLX(x, y, double) +#define CMPLXF(x, y) __CMPLX(x, y, float) +#define CMPLXL(x, y) __CMPLX(x, y, long double) + +hidden double complex __ldexp_cexp(double complex,int); +hidden float complex __ldexp_cexpf(float complex,int); + +#endif diff --git a/src/internal/libm.h b/src/internal/libm.h index fd916277..6e2d1900 100644 --- a/src/internal/libm.h +++ b/src/internal/libm.h @@ -16,7 +16,6 @@ #include #include #include -#include #include #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 @@ -153,18 +152,6 @@ do { \ (d) = __u.f; \ } while (0) -#undef __CMPLX -#undef CMPLX -#undef CMPLXF -#undef CMPLXL - -#define __CMPLX(x, y, t) \ - ((union { _Complex t __z; t __xy[2]; }){.__xy = {(x),(y)}}.__z) - -#define CMPLX(x, y) __CMPLX(x, y, double) -#define CMPLXF(x, y) __CMPLX(x, y, float) -#define CMPLXL(x, y) __CMPLX(x, y, long double) - /* fdlibm kernel functions */ hidden int __rem_pio2_large(double*,double*,int,int,int); @@ -174,14 +161,12 @@ hidden double __sin(double,double,int); hidden double __cos(double,double); hidden double __tan(double,double,int); hidden double __expo2(double); -hidden double complex __ldexp_cexp(double complex,int); hidden int __rem_pio2f(float,double*); hidden float __sindf(double); hidden float __cosdf(double); hidden float __tandf(double,int); hidden float __expo2f(float); -hidden float complex __ldexp_cexpf(float complex,int); hidden int __rem_pio2l(long double, long double *); hidden long double __sinl(long double, long double, int); -- 2.25.1