* 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 */
* 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 */
-#include "libm.h"
+#include "complex_impl.h"
double cabs(double complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
float cabsf(float complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double cabsl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
// FIXME: Hull et al. "Implementing the complex arcsine and arccosine functions using exception handling" 1997
-#include "libm.h"
+#include "complex_impl.h"
// FIXME
-#include "libm.h"
+#include "complex_impl.h"
/* acosh(z) = i acos(z) */
-#include "libm.h"
+#include "complex_impl.h"
float complex cacoshf(float complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex cacoshl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex cacosl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
double carg(double complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
float cargf(float complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double cargl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
// FIXME
-#include "libm.h"
+#include "complex_impl.h"
// FIXME
-#include "libm.h"
+#include "complex_impl.h"
/* asinh(z) = -i asin(i z) */
-#include "libm.h"
+#include "complex_impl.h"
float complex casinhf(float complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex casinhl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex casinl(long double complex z)
* 2.9e-17. See also clog().
*/
-#include "libm.h"
+#include "complex_impl.h"
#define MAXNUM 1.0e308
* IEEE -10,+10 30000 2.3e-6 5.2e-8
*/
-#include "libm.h"
+#include "complex_impl.h"
#define MAXNUMF 1.0e38F
-#include "libm.h"
+#include "complex_impl.h"
/* atanh = -i atan(i z) */
-#include "libm.h"
+#include "complex_impl.h"
float complex catanhf(float complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex catanhl(long double complex z)
#include <complex.h>
#include <float.h>
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex catanl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
/* cos(z) = cosh(i z) */
-#include "libm.h"
+#include "complex_impl.h"
float complex ccosf(float complex z)
{
* These values and the return value were taken from n1124.pdf.
*/
-#include "libm.h"
+#include "complex_impl.h"
static const double huge = 0x1p1023;
* Hyperbolic cosine of a complex argument. See s_ccosh.c for details.
*/
-#include "libm.h"
+#include "complex_impl.h"
static const float huge = 0x1p127;
-#include "libm.h"
+#include "complex_impl.h"
//FIXME
long double complex ccoshl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex ccosl(long double complex z)
* SUCH DAMAGE.
*/
-#include "libm.h"
+#include "complex_impl.h"
static const uint32_t
exp_ovfl = 0x40862e42, /* high bits of MAX_EXP * ln2 ~= 710 */
* SUCH DAMAGE.
*/
-#include "libm.h"
+#include "complex_impl.h"
static const uint32_t
exp_ovfl = 0x42b17218, /* MAX_EXP * ln2 ~= 88.722839355 */
-#include "libm.h"
+#include "complex_impl.h"
//FIXME
long double complex cexpl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
double (cimag)(double complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
float (cimagf)(float complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
long double (cimagl)(long double complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
// FIXME
-#include "libm.h"
+#include "complex_impl.h"
// FIXME
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex clogl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
double complex conj(double complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
float complex conjf(float complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
long double complex conjl(long double complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
/* pow(z, c) = exp(c log(z)), See C99 G.6.4.1 */
-#include "libm.h"
+#include "complex_impl.h"
float complex cpowf(float complex z, float complex c)
{
-#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)
-#include "libm.h"
+#include "complex_impl.h"
double complex cproj(double complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
float complex cprojf(float complex z)
{
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex cprojl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
/* sin(z) = -i sinh(i z) */
-#include "libm.h"
+#include "complex_impl.h"
float complex csinf(float complex z)
{
* These values and the return value were taken from n1124.pdf.
*/
-#include "libm.h"
+#include "complex_impl.h"
static const double huge = 0x1p1023;
* 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;
-#include "libm.h"
+#include "complex_impl.h"
//FIXME
long double complex csinhl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex csinl(long double complex z)
* SUCH DAMAGE.
*/
-#include "libm.h"
+#include "complex_impl.h"
/*
* gcc doesn't implement complex multiplication or division correctly,
* SUCH DAMAGE.
*/
-#include "libm.h"
+#include "complex_impl.h"
/*
* gcc doesn't implement complex multiplication or division correctly,
-#include "libm.h"
+#include "complex_impl.h"
//FIXME
long double complex csqrtl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
/* tan(z) = -i tanh(i z) */
-#include "libm.h"
+#include "complex_impl.h"
float complex ctanf(float complex z)
{
* precision. I also handle large x differently.
*/
-#include "libm.h"
+#include "complex_impl.h"
double complex ctanh(double complex z)
{
* 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)
{
-#include "libm.h"
+#include "complex_impl.h"
//FIXME
long double complex ctanhl(long double complex z)
-#include "libm.h"
+#include "complex_impl.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double complex ctanl(long double complex z)
--- /dev/null
+#ifndef _COMPLEX_IMPL_H
+#define _COMPLEX_IMPL_H
+
+#include <complex.h>
+#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
#include <stdint.h>
#include <float.h>
#include <math.h>
-#include <complex.h>
#include <endian.h>
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
(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);
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);