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