source: rtems/testsuites/libtests/mathl/domathl.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: 6.7 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 math routines.
11 */
12
13#ifdef HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <math.h>
18#include <stdio.h>
19
20#ifndef M_PI_2
21#define M_PI_2 1.57079632679489661923
22#endif
23
24#ifndef M_PI_4
25#define M_PI_4 0.78539816339744830962
26#endif
27
28void
29domathl (void)
30{
31#ifndef NO_LONG_DOUBLE
32  long double f1;
33  long double f2;
34
35  int i1;
36
37  f1 = acosl(0.0);
38  fprintf( stdout, "acosl          : %Lf\n", f1);
39
40  f1 = acoshl(0.0);
41  fprintf( stdout, "acoshl         : %Lf\n", f1);
42
43  f1 = asinl(1.0);
44  fprintf( stdout, "asinl          : %Lf\n", f1);
45
46  f1 = asinhl(1.0);
47  fprintf( stdout, "asinhl         : %Lf\n", f1);
48
49  f1 = atanl(M_PI_4);
50  fprintf( stdout, "atanl          : %Lf\n", f1);
51
52  f1 = atan2l(2.3, 2.3);
53  fprintf( stdout, "atan2l         : %Lf\n", f1);
54
55  f1 = atanhl(1.0);
56  fprintf( stdout, "atanhl         : %Lf\n", f1);
57
58  f1 = cbrtl(27.0);
59  fprintf( stdout, "cbrtl          : %Lf\n", f1);
60
61  f1 = ceill(3.5);
62  fprintf( stdout, "ceill          : %Lf\n", f1);
63
64  f1 = copysignl(3.5, -2.5);
65  fprintf( stdout, "copysignl      : %Lf\n", f1);
66
67  f1 = cosl(M_PI_2);
68  fprintf( stdout, "cosl           : %Lf\n", f1);
69
70  f1 = coshl(M_PI_2);
71  fprintf( stdout, "coshl          : %Lf\n", f1);
72
73  f1 = erfl(42.0);
74  fprintf( stdout, "erfl           : %Lf\n", f1);
75
76  f1 = erfcl(42.0);
77  fprintf( stdout, "erfcl          : %Lf\n", f1);
78
79  f1 = expl(0.42);
80  fprintf( stdout, "expl           : %Lf\n", f1);
81
82  f1 = exp2l(0.42);
83  fprintf( stdout, "exp2l          : %Lf\n", f1);
84
85  f1 = expm1l(0.00042);
86  fprintf( stdout, "expm1l         : %Lf\n", f1);
87
88  f1 = fabsl(-1.123);
89  fprintf( stdout, "fabsl          : %Lf\n", f1);
90
91  f1 = fdiml(1.123, 2.123);
92  fprintf( stdout, "fdiml          : %Lf\n", f1);
93
94  f1 = floorl(0.5);
95  fprintf( stdout, "floorl         : %Lf\n", f1);
96  f1 = floorl(-0.5);
97  fprintf( stdout, "floorl         : %Lf\n", f1);
98
99  f1 = fmal(2.1, 2.2, 3.01);
100  fprintf( stdout, "fmal           : %Lf\n", f1);
101
102  f1 = fmaxl(-0.42, 0.42);
103  fprintf( stdout, "fmaxl          : %Lf\n", f1);
104
105  f1 = fminl(-0.42, 0.42);
106  fprintf( stdout, "fminl          : %Lf\n", f1);
107
108  f1 = fmodl(42.0, 3.0);
109  fprintf( stdout, "fmodl          : %Lf\n", f1);
110
111  /* no type-specific variant */
112  i1 = fpclassify(1.0);
113  fprintf( stdout, "fpclassify     : %d\n", i1);
114
115  f1 = frexpl(42.0, &i1);
116  fprintf( stdout, "frexpl         : %Lf\n", f1);
117
118  f1 = hypotl(42.0, 42.0);
119  fprintf( stdout, "hypotl         : %Lf\n", f1);
120
121  i1 = ilogbl(42.0);
122  fprintf( stdout, "ilogbl         : %d\n", i1);
123
124  /* no type-specific variant */
125  i1 = isfinite(3.0);
126  fprintf( stdout, "isfinite       : %d\n", i1);
127
128  /* no type-specific variant */
129  i1 = isgreater(3.0, 3.1);
130  fprintf( stdout, "isgreater      : %d\n", i1);
131
132  /* no type-specific variant */
133  i1 = isgreaterequal(3.0, 3.1);
134  fprintf( stdout, "isgreaterequal : %d\n", i1);
135
136  /* no type-specific variant */
137  i1 = isinf(3.0);
138  fprintf( stdout, "isinf          : %d\n", i1);
139
140  /* no type-specific variant */
141  i1 = isless(3.0, 3.1);
142  fprintf( stdout, "isless         : %d\n", i1);
143
144  /* no type-specific variant */
145  i1 = islessequal(3.0, 3.1);
146  fprintf( stdout, "islessequal    : %d\n", i1);
147
148  /* no type-specific variant */
149  i1 = islessgreater(3.0, 3.1);
150  fprintf( stdout, "islessgreater  : %d\n", i1);
151
152  /* no type-specific variant */
153  i1 = isnan(0.0);
154  fprintf( stdout, "isnan          : %d\n", i1);
155
156  /* no type-specific variant */
157  i1 = isnormal(3.0);
158  fprintf( stdout, "isnormal       : %d\n", i1);
159
160  /* no type-specific variant */
161  f1 = isunordered(1.0, 2.0);
162  fprintf( stdout, "isunordered    : %d\n", i1);
163
164  f1 = j0l(1.2);
165  fprintf( stdout, "j0l            : %Lf\n", f1);
166
167  f1 = j1l(1.2);
168  fprintf( stdout, "j1l            : %Lf\n", f1);
169
170  f1 = jnl(2,1.2);
171  fprintf( stdout, "jnl            : %Lf\n", f1);
172
173  f1 = ldexpl(1.2,3);
174  fprintf( stdout, "ldexpl         : %Lf\n", f1);
175
176  f1 = lgammal(42.0);
177  fprintf( stdout, "lgammal        : %Lf\n", f1);
178
179  f1 = llrintl(-0.5);
180  fprintf( stdout, "llrintl        : %Lf\n", f1);
181  f1 = llrintl(0.5);
182  fprintf( stdout, "llrintl        : %Lf\n", f1);
183
184  f1 = llroundl(-0.5);
185  fprintf( stdout, "lroundl        : %Lf\n", f1);
186  f1 = llroundl(0.5);
187  fprintf( stdout, "lroundl        : %Lf\n", f1);
188
189  f1 = logl(42.0);
190  fprintf( stdout, "logl           : %Lf\n", f1);
191
192  f1 = log10l(42.0);
193  fprintf( stdout, "log10l         : %Lf\n", f1);
194
195  f1 = log1pl(42.0);
196  fprintf( stdout, "log1pl         : %Lf\n", f1);
197
198  f1 = log2l(42.0);
199  fprintf( stdout, "log2l          : %Lf\n", f1);
200
201  f1 = logbl(42.0);
202  fprintf( stdout, "logbl          : %Lf\n", f1);
203
204  f1 = lrintl(-0.5);
205  fprintf( stdout, "lrintl         : %Lf\n", f1);
206  f1 = lrintl(0.5);
207  fprintf( stdout, "lrintl         : %Lf\n", f1);
208
209  f1 = lroundl(-0.5);
210  fprintf( stdout, "lroundl        : %Lf\n", f1);
211  f1 = lroundl(0.5);
212  fprintf( stdout, "lroundl        : %Lf\n", f1);
213
214  f1 = modfl(42.0,&f2);
215  fprintf( stdout, "lmodfl         : %Lf\n", f1);
216
217  f1 = nanl("");
218  fprintf( stdout, "nanl           : %Lf\n", f1);
219
220  f1 = nearbyintl(1.5);
221  fprintf( stdout, "nearbyintl     : %Lf\n", f1);
222
223  f1 = nextafterl(1.5,2.0);
224  fprintf( stdout, "nextafterl     : %Lf\n", f1);
225
226  f1 = powl(3.01, 2.0);
227  fprintf( stdout, "powl           : %Lf\n", f1);
228
229  f1 = remainderl(3.01,2.0);
230  fprintf( stdout, "remainderl     : %Lf\n", f1);
231
232  f1 = remquol(29.0,3.0,&i1);
233  fprintf( stdout, "remquol        : %Lf\n", f1);
234
235  f1 = rintl(0.5);
236  fprintf( stdout, "rintl          : %Lf\n", f1);
237  f1 = rintl(-0.5);
238  fprintf( stdout, "rintl          : %Lf\n", f1);
239
240  f1 = roundl(0.5);
241  fprintf( stdout, "roundl         : %Lf\n", f1);
242  f1 = roundl(-0.5);
243  fprintf( stdout, "roundl         : %Lf\n", f1);
244
245  f1 = scalblnl(1.2,3);
246  fprintf( stdout, "scalblnl       : %Lf\n", f1);
247
248  f1 = scalbnl(1.2,3);
249  fprintf( stdout, "scalbnl        : %Lf\n", f1);
250
251  /* no type-specific variant */
252  i1 = signbit(1.0);
253  fprintf( stdout, "signbit        : %i\n", i1);
254
255  f1 = sinl(M_PI_4);
256  fprintf( stdout, "sinl           : %Lf\n", f1);
257
258  f1 = sinhl(M_PI_4);
259  fprintf( stdout, "sinhl          : %Lf\n", f1);
260
261  f1 = sqrtl(9.0);
262  fprintf( stdout, "sqrtl          : %Lf\n", f1);
263
264  f1 = tanl(M_PI_4);
265  fprintf( stdout, "tanl           : %Lf\n", f1);
266
267  f1 = tanhl(M_PI_4);
268  fprintf( stdout, "tanhl          : %Lf\n", f1);
269
270  f1 = tgammal(2.1);
271  fprintf( stdout, "tgammal        : %Lf\n", f1);
272
273  f1 = truncl(3.5);
274  fprintf( stdout, "truncl         : %Lf\n", f1);
275
276  f1 = y0l(1.2);
277  fprintf( stdout, "y0l            : %Lf\n", f1);
278
279  f1 = y1l(1.2);
280  fprintf( stdout, "y1l            : %Lf\n", f1);
281
282  f1 = ynl(3,1.2);
283  fprintf( stdout, "ynl            : %Lf\n", f1);
284#endif
285}
Note: See TracBrowser for help on using the repository browser.