aboutsummaryrefslogtreecommitdiff
path: root/include/complex.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-11-15 08:37:58 -0500
committerRich Felker <dalias@aerifal.cx>2012-11-15 08:37:58 -0500
commit8bb181622222f2ee3462c8b021bcae4fcdbbd37a (patch)
tree166a1be834c8cd5a4c2521d41d7ee506bd8c8e51 /include/complex.h
parentupdate copyright file for recent contributions (diff)
parentfenv: return FE_TONEAREST in dummy fegetround (diff)
downloadgrovel-8bb181622222f2ee3462c8b021bcae4fcdbbd37a.tar.gz
grovel-8bb181622222f2ee3462c8b021bcae4fcdbbd37a.tar.xz
Merge remote-tracking branch 'nsz/math'
Diffstat (limited to 'include/complex.h')
-rw-r--r--include/complex.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/complex.h b/include/complex.h
index b4bcb22e..8206e026 100644
--- a/include/complex.h
+++ b/include/complex.h
@@ -112,6 +112,15 @@ long double creall(long double complex);
#define cimagf(x) __CIMAG(x, float)
#define cimagl(x) __CIMAG(x, long double)
+#define __CMPLX(x, y, t) \
+ ((union { _Complex t __z; t __xy[2]; }){.__xy = {(x),(y)}}.__z)
+
+#if __STDC_VERSION__ >= 201112L
+#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)
+#endif
+
#ifdef __cplusplus
}
#endif