master
  1#ifndef _COMPLEX_H
  2#define _COMPLEX_H
  3
  4#ifdef __cplusplus
  5extern "C" {
  6#endif
  7
  8#define complex _Complex
  9#ifdef __GNUC__
 10#define _Complex_I (__extension__ (0.0f+1.0fi))
 11#else
 12#define _Complex_I (0.0f+1.0fi)
 13#endif
 14#define I _Complex_I
 15
 16double complex cacos(double complex);
 17float complex cacosf(float complex);
 18long double complex cacosl(long double complex);
 19
 20double complex casin(double complex);
 21float complex casinf(float complex);
 22long double complex casinl(long double complex);
 23
 24double complex catan(double complex);
 25float complex catanf(float complex);
 26long double complex catanl(long double complex);
 27
 28double complex ccos(double complex);
 29float complex ccosf(float complex);
 30long double complex ccosl(long double complex);
 31
 32double complex csin(double complex);
 33float complex csinf(float complex);
 34long double complex csinl(long double complex);
 35
 36double complex ctan(double complex);
 37float complex ctanf(float complex);
 38long double complex ctanl(long double complex);
 39
 40double complex cacosh(double complex);
 41float complex cacoshf(float complex);
 42long double complex cacoshl(long double complex);
 43
 44double complex casinh(double complex);
 45float complex casinhf(float complex);
 46long double complex casinhl(long double complex);
 47
 48double complex catanh(double complex);
 49float complex catanhf(float complex);
 50long double complex catanhl(long double complex);
 51
 52double complex ccosh(double complex);
 53float complex ccoshf(float complex);
 54long double complex ccoshl(long double complex);
 55
 56double complex csinh(double complex);
 57float complex csinhf(float complex);
 58long double complex csinhl(long double complex);
 59
 60double complex ctanh(double complex);
 61float complex ctanhf(float complex);
 62long double complex ctanhl(long double complex);
 63
 64double complex cexp(double complex);
 65float complex cexpf(float complex);
 66long double complex cexpl(long double complex);
 67
 68double complex clog(double complex);
 69float complex clogf(float complex);
 70long double complex clogl(long double complex);
 71
 72double cabs(double complex);
 73float cabsf(float complex);
 74long double cabsl(long double complex);
 75
 76double complex cpow(double complex, double complex);
 77float complex cpowf(float complex, float complex);
 78long double complex cpowl(long double complex, long double complex);
 79
 80double complex csqrt(double complex);
 81float complex csqrtf(float complex);
 82long double complex csqrtl(long double complex);
 83
 84double carg(double complex);
 85float cargf(float complex);
 86long double cargl(long double complex);
 87
 88double cimag(double complex);
 89float cimagf(float complex);
 90long double cimagl(long double complex);
 91
 92double complex conj(double complex);
 93float complex conjf(float complex);
 94long double complex conjl(long double complex);
 95
 96double complex cproj(double complex);
 97float complex cprojf(float complex);
 98long double complex cprojl(long double complex);
 99
100double creal(double complex);
101float crealf(float complex);
102long double creall(long double complex);
103
104#ifndef __cplusplus
105#define __CIMAG(x, t) \
106	(+(union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1])
107
108#define creal(x) ((double)(x))
109#define crealf(x) ((float)(x))
110#define creall(x) ((long double)(x))
111
112#define cimag(x) __CIMAG(x, double)
113#define cimagf(x) __CIMAG(x, float)
114#define cimagl(x) __CIMAG(x, long double)
115#endif
116
117#if __STDC_VERSION__ >= 201112L
118#if defined(_Imaginary_I)
119#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I*(t)(y))
120#elif defined(__clang__)
121#define __CMPLX(x, y, t) (+(_Complex t){ (t)(x), (t)(y) })
122#else
123#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y)))
124#endif
125#define CMPLX(x, y) __CMPLX(x, y, double)
126#define CMPLXF(x, y) __CMPLX(x, y, float)
127#define CMPLXL(x, y) __CMPLX(x, y, long double)
128#endif
129
130#ifdef __cplusplus
131}
132#endif
133#endif