source: rtems/testsuites/libtests/complex/docomplex.c @ 0c2d8ec

4.115
Last change on this file since 0c2d8ec was 0c2d8ec, checked in by Ralf Corsépius <ralf.corsepius@…>, on 05/23/12 at 14:44:33

Revert "libtests/complex: Avoid generated files"

This reverts commit a80a108d447d596e476611108cd468ec993be4a6.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 * Copyright (c) 2010, 2011 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
20extern void docomplex  (void);
21
22void
23docomplex  (void)
24{
25#ifndef NO_DOUBLE
26  complex double ca, cb, cc;
27  double f1;
28
29  ca = 1.0 + 1.0 * I;
30  cb = 1.0 - 1.0 * I;
31
32  f1 = cabs  (ca);
33  fprintf (stdout, "cabs   : %f\n", f1);
34
35  cc = cacos  (ca);
36  fprintf (stdout, "cacos  : %f %fi\n", creal  (cc),
37           cimag  (cc));
38
39  cc = cacosh  (ca);
40  fprintf (stdout, "cacosh : %f %fi\n", creal  (cc),
41           cimag  (cc));
42
43  f1 = carg  (ca);
44  fprintf (stdout, "carg   : %f\n", f1);
45
46  cc = casin  (ca);
47  fprintf (stdout, "casin  : %f %fi\n", creal  (cc),
48           cimag  (cc));
49
50  cc = casinh  (ca);
51  fprintf (stdout, "casinh : %f %fi\n", creal  (cc),
52           cimag  (cc));
53
54  cc = catan  (ca);
55  fprintf (stdout, "catan  : %f %fi\n", creal  (cc),
56           cimag  (cc));
57
58  cc = catanh  (ca);
59  fprintf (stdout, "catanh : %f %fi\n", creal  (cc),
60           cimag  (cc));
61
62  cc = ccos  (ca);
63  fprintf (stdout, "ccos   : %f %fi\n", creal  (cc),
64           cimag  (cc));
65
66  cc = ccosh  (ca);
67  fprintf (stdout, "ccosh  : %f %fi\n", creal  (cc),
68           cimag  (cc));
69
70  cc = cexp  (ca);
71  fprintf (stdout, "cexp   : %f %fi\n", creal  (cc),
72           cimag  (cc));
73
74  f1 = cimag  (ca);
75  fprintf (stdout, "cimag  : %f\n", f1);
76
77  cc = clog  (ca);
78  fprintf (stdout, "clog   : %f %fi\n", creal  (cc),
79           cimag  (cc));
80
81  cc = conj  (ca);
82  fprintf (stdout, "conj   : %f %fi\n", creal  (cc),
83           cimag  (cc));
84
85  cc = cpow  (ca, cb);
86  fprintf (stdout, "cpow   : %f %fi\n", creal  (cc),
87           cimag  (cc));
88
89  cc = cproj  (ca);
90  fprintf (stdout, "cproj  : %f %fi\n", creal  (cc),
91           cimag  (cc));
92
93  f1 = creal  (ca);
94  fprintf (stdout, "creal  : %f\n", f1);
95
96  cc = csin  (ca);
97  fprintf (stdout, "csin   : %f %fi\n", creal  (cc),
98           cimag  (cc));
99
100  cc = csinh  (ca);
101  fprintf (stdout, "csinh  : %f %fi\n", creal  (cc),
102           cimag  (cc));
103
104  cc = csqrt  (ca);
105  fprintf (stdout, "csqrt  : %f %fi\n", creal  (cc),
106           cimag  (cc));
107
108  cc = ctan  (ca);
109  fprintf (stdout, "ctan   : %f %fi\n", creal  (cc),
110           cimag  (cc));
111
112  cc = ctanh  (ca);
113  fprintf (stdout, "ctanh  : %f %fi\n", creal  (cc),
114           cimag  (cc));
115#endif
116}
Note: See TracBrowser for help on using the repository browser.