source: rtems/testsuites/libtests/complex/docomplex.c @ 7d3f9c6

4.115
Last change on this file since 7d3f9c6 was 7d3f9c6, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/22/11 at 07:37:03

Add HAVE_CONFIG_H.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 * Copyright (c) 2010 by
3 * Ralf Corsepius, Ulm/Germany. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this software
6 * is freely granted, provided that this notice is preserved.
7 */
8
9/*
10 * Try to compile and link against POSIX complex math routines.
11 */
12
13#ifdef HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <complex.h>
18#include <stdio.h>
19
20void
21docomplex  (void)
22{
23#ifndef NO_DOUBLE
24  complex double ca, cb, cc;
25  double f1;
26
27  ca = 1.0 + 1.0 * I;
28  cb = 1.0 - 1.0 * I;
29
30  f1 = cabs  (ca);
31  fprintf (stdout, "cabs   : %f\n", f1);
32
33  cc = cacos  (ca);
34  fprintf (stdout, "cacos  : %f %fi\n", creal  (cc),
35           cimag  (cc));
36
37  cc = cacosh  (ca);
38  fprintf (stdout, "cacosh : %f %fi\n", creal  (cc),
39           cimag  (cc));
40
41  f1 = carg  (ca);
42  fprintf (stdout, "carg   : %f\n", f1);
43
44  cc = casin  (ca);
45  fprintf (stdout, "casin  : %f %fi\n", creal  (cc),
46           cimag  (cc));
47
48  cc = casinh  (ca);
49  fprintf (stdout, "casinh : %f %fi\n", creal  (cc),
50           cimag  (cc));
51
52  cc = catan  (ca);
53  fprintf (stdout, "catan  : %f %fi\n", creal  (cc),
54           cimag  (cc));
55
56  cc = catanh  (ca);
57  fprintf (stdout, "catanh : %f %fi\n", creal  (cc),
58           cimag  (cc));
59
60  cc = ccos  (ca);
61  fprintf (stdout, "ccos   : %f %fi\n", creal  (cc),
62           cimag  (cc));
63
64  cc = ccosh  (ca);
65  fprintf (stdout, "ccosh  : %f %fi\n", creal  (cc),
66           cimag  (cc));
67
68  cc = cexp  (ca);
69  fprintf (stdout, "cexp   : %f %fi\n", creal  (cc),
70           cimag  (cc));
71
72  f1 = cimag  (ca);
73  fprintf (stdout, "cimag  : %f\n", f1);
74
75  cc = clog  (ca);
76  fprintf (stdout, "clog   : %f %fi\n", creal  (cc),
77           cimag  (cc));
78
79  cc = conj  (ca);
80  fprintf (stdout, "conj   : %f %fi\n", creal  (cc),
81           cimag  (cc));
82
83  cc = cpow  (ca, cb);
84  fprintf (stdout, "cpow   : %f %fi\n", creal  (cc),
85           cimag  (cc));
86
87  cc = cproj  (ca);
88  fprintf (stdout, "cproj  : %f %fi\n", creal  (cc),
89           cimag  (cc));
90
91  f1 = creal  (ca);
92  fprintf (stdout, "creal  : %f\n", f1);
93
94  cc = csin  (ca);
95  fprintf (stdout, "csin   : %f %fi\n", creal  (cc),
96           cimag  (cc));
97
98  cc = csinh  (ca);
99  fprintf (stdout, "csinh  : %f %fi\n", creal  (cc),
100           cimag  (cc));
101
102  cc = csqrt  (ca);
103  fprintf (stdout, "csqrt  : %f %fi\n", creal  (cc),
104           cimag  (cc));
105
106  cc = ctan  (ca);
107  fprintf (stdout, "ctan   : %f %fi\n", creal  (cc),
108           cimag  (cc));
109
110  cc = ctanh  (ca);
111  fprintf (stdout, "ctanh  : %f %fi\n", creal  (cc),
112           cimag  (cc));
113#endif
114}
Note: See TracBrowser for help on using the repository browser.