summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/complex/docomplexl.c
blob: a6fe3b0dd0145b7aa31054d96f0b2c2ebb6a2990 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 * Copyright (c) 2010 by
 * Ralf Corsepius, Ulm/Germany. All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software
 * is freely granted, provided that this notice is preserved.
 */

/*
 * Try to compile and link against POSIX complex math routines.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <complex.h>
#include <stdio.h>

void
docomplexl (void)
{
#ifndef NO_LONG_DOUBLE
  complex long double ca, cb, cc;
  long double f1;

  ca = 1.0 + 1.0 * I;
  cb = 1.0 - 1.0 * I;

  f1 = cabsl (ca);
  fprintf (stdout, "cabsl  : %Lf\n", f1);

  cc = cacosl (ca);
  fprintf (stdout, "cacosl : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = cacoshl (ca);
  fprintf (stdout, "cacoshl: %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  f1 = cargl (ca);
  fprintf (stdout, "cargl  : %Lf\n", f1);

  cc = casinl (ca);
  fprintf (stdout, "casinl : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = casinhl (ca);
  fprintf (stdout, "casinhl: %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = catanl (ca);
  fprintf (stdout, "catanl : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = catanhl (ca);
  fprintf (stdout, "catanhl: %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = ccosl (ca);
  fprintf (stdout, "ccosl  : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = ccoshl (ca);
  fprintf (stdout, "ccoshl : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = cexpl (ca);
  fprintf (stdout, "cexpl  : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  f1 = cimagl (ca);
  fprintf (stdout, "cimagl : %Lf\n", f1);

  cc = clogl (ca);
  fprintf (stdout, "clogl  : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = conjl (ca);
  fprintf (stdout, "conjl  : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = cpowl (ca, cb);
  fprintf (stdout, "cpowl  : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = cprojl (ca);
  fprintf (stdout, "cprojl : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  f1 = creall (ca);
  fprintf (stdout, "creall : %Lf\n", f1);

  cc = csinl (ca);
  fprintf (stdout, "csinl  : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = csinhl (ca);
  fprintf (stdout, "csinhl : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = csqrtl (ca);
  fprintf (stdout, "csqrtl : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = ctanl (ca);
  fprintf (stdout, "ctanl  : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));

  cc = ctanhl (ca);
  fprintf (stdout, "ctanhl : %Lf %Lfi\n", creall (cc),
	   cimagl (cc));
#endif
}