Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-10-08 14:35:14 +0400
committerCorinna Vinschen <corinna@vinschen.de>2010-10-08 14:35:14 +0400
commit5af2a793bc8cc1a41783515ded2aee98d7e50644 (patch)
treed07f6b0863fe8607d1290980d9bd5ae0a75f2cff /newlib/libm/common/fdlibm.h
parent1a91b8c0ac168f498576bd8833e8d4a7197fce57 (diff)
* libc/include/complex.h: New complex header.
* libm/common/fdlibm.h: Added ifdef _COMPLEX_H. * libm/complex/*: New complex functions imported from NetBSD. * libm/Makefile.am: Added complex subdir. * libm/Makefile.in: Regenerate. * libm/configure.in: Added complex subdir. * libm/configure: Regenerate.
Diffstat (limited to 'newlib/libm/common/fdlibm.h')
-rw-r--r--newlib/libm/common/fdlibm.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/newlib/libm/common/fdlibm.h b/newlib/libm/common/fdlibm.h
index ab0ada1a1..a4b7fffe7 100644
--- a/newlib/libm/common/fdlibm.h
+++ b/newlib/libm/common/fdlibm.h
@@ -371,3 +371,34 @@ do { \
#define SAFE_RIGHT_SHIFT(op,amt) \
(((amt) < 8 * sizeof(op)) ? ((op) >> (amt)) : 0)
+#ifdef _COMPLEX_H
+
+/*
+ * Quoting from ISO/IEC 9899:TC2:
+ *
+ * 6.2.5.13 Types
+ * Each complex type has the same representation and alignment requirements as
+ * an array type containing exactly two elements of the corresponding real type;
+ * the first element is equal to the real part, and the second element to the
+ * imaginary part, of the complex number.
+ */
+typedef union {
+ float complex z;
+ float parts[2];
+} float_complex;
+
+typedef union {
+ double complex z;
+ double parts[2];
+} double_complex;
+
+typedef union {
+ long double complex z;
+ long double parts[2];
+} long_double_complex;
+
+#define REAL_PART(z) ((z).parts[0])
+#define IMAG_PART(z) ((z).parts[1])
+
+#endif /* _COMPLEX_H */
+