summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/complex/docomplex.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/libtests/complex/docomplex.c')
-rw-r--r--testsuites/libtests/complex/docomplex.c106
1 files changed, 99 insertions, 7 deletions
diff --git a/testsuites/libtests/complex/docomplex.c b/testsuites/libtests/complex/docomplex.c
index 4872b5d15c..7a1b96135b 100644
--- a/testsuites/libtests/complex/docomplex.c
+++ b/testsuites/libtests/complex/docomplex.c
@@ -11,14 +11,106 @@
*/
#ifdef HAVE_CONFIG_H
- #include "config.h"
+#include "config.h"
#endif
-#ifdef NO_DOUBLE
- #define PROVIDE_EMPTY_FUNC
-#endif
+#include <complex.h>
+#include <stdio.h>
+
+extern void docomplex (void);
+
+void
+docomplex (void)
+{
+#ifndef NO_DOUBLE
+ complex double ca, cb, cc;
+ double f1;
+
+ ca = 1.0 + 1.0 * I;
+ cb = 1.0 - 1.0 * I;
+
+ f1 = cabs (ca);
+ fprintf (stdout, "cabs : %f\n", f1);
+
+ cc = cacos (ca);
+ fprintf (stdout, "cacos : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = cacosh (ca);
+ fprintf (stdout, "cacosh : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ f1 = carg (ca);
+ fprintf (stdout, "carg : %f\n", f1);
+
+ cc = casin (ca);
+ fprintf (stdout, "casin : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = casinh (ca);
+ fprintf (stdout, "casinh : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = catan (ca);
+ fprintf (stdout, "catan : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = catanh (ca);
+ fprintf (stdout, "catanh : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = ccos (ca);
+ fprintf (stdout, "ccos : %f %fi\n", creal (cc),
+ cimag (cc));
-#define FTYPE double
-#define PRI "%f"
+ cc = ccosh (ca);
+ fprintf (stdout, "ccosh : %f %fi\n", creal (cc),
+ cimag (cc));
-#include "docomplex.h"
+ cc = cexp (ca);
+ fprintf (stdout, "cexp : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ f1 = cimag (ca);
+ fprintf (stdout, "cimag : %f\n", f1);
+
+ cc = clog (ca);
+ fprintf (stdout, "clog : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = conj (ca);
+ fprintf (stdout, "conj : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = cpow (ca, cb);
+ fprintf (stdout, "cpow : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = cproj (ca);
+ fprintf (stdout, "cproj : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ f1 = creal (ca);
+ fprintf (stdout, "creal : %f\n", f1);
+
+ cc = csin (ca);
+ fprintf (stdout, "csin : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = csinh (ca);
+ fprintf (stdout, "csinh : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = csqrt (ca);
+ fprintf (stdout, "csqrt : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = ctan (ca);
+ fprintf (stdout, "ctan : %f %fi\n", creal (cc),
+ cimag (cc));
+
+ cc = ctanh (ca);
+ fprintf (stdout, "ctanh : %f %fi\n", creal (cc),
+ cimag (cc));
+#endif
+}