]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - tools/regression/lib/msun/test-invtrig.c
MFC r292497:
[FreeBSD/stable/10.git] / tools / regression / lib / msun / test-invtrig.c
1 /*-
2  * Copyright (c) 2008 David Schultz <das@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  */
26
27 /*
28  * Tests for corner cases in the inverse trigonometric functions. Some
29  * accuracy tests are included as well, but these are very basic
30  * sanity checks, not intended to be comprehensive.
31  */
32
33 #include <sys/cdefs.h>
34 __FBSDID("$FreeBSD$");
35
36 #include <assert.h>
37 #include <fenv.h>
38 #include <float.h>
39 #include <math.h>
40 #include <stdio.h>
41
42 #include "test-utils.h"
43
44 #define LEN(a)          (sizeof(a) / sizeof((a)[0]))
45
46 #pragma STDC FENV_ACCESS ON
47
48 /*
49  * Test that a function returns the correct value and sets the
50  * exception flags correctly. A tolerance specifying the maximum
51  * relative error allowed may be specified. For the 'testall'
52  * functions, the tolerance is specified in ulps.
53  *
54  * These are macros instead of functions so that assert provides more
55  * meaningful error messages.
56  */
57 #define test_tol(func, x, result, tol, excepts) do {                    \
58         volatile long double _in = (x), _out = (result);                \
59         assert(feclearexcept(FE_ALL_EXCEPT) == 0);                      \
60         assert(fpequal_tol(func(_in), _out, (tol), CS_BOTH));           \
61         assert(((void)func, fetestexcept(ALL_STD_EXCEPT) == (excepts))); \
62 } while (0)
63 #define test(func, x, result, excepts)                                  \
64         test_tol(func, (x), (result), 0, (excepts))
65
66 #define _testall_tol(prefix, x, result, tol, excepts) do {              \
67         test_tol(prefix, (double)(x), (double)(result),                 \
68                  (tol) * ldexp(1.0, 1 - DBL_MANT_DIG), (excepts));      \
69         test_tol(prefix##f, (float)(x), (float)(result),                \
70                  (tol) * ldexpf(1.0, 1 - FLT_MANT_DIG), (excepts));     \
71 } while (0)
72
73 #if LDBL_PREC == 53
74 #define testall_tol     _testall_tol
75 #else
76 #define testall_tol(prefix, x, result, tol, excepts) do {               \
77         _testall_tol(prefix, x, result, tol, excepts);                  \
78         test_tol(prefix##l, (x), (result),                              \
79                  (tol) * ldexpl(1.0, 1 - LDBL_MANT_DIG), (excepts));    \
80 } while (0)
81 #endif
82
83 #define testall(prefix, x, result, excepts)                             \
84         testall_tol(prefix, (x), (result), 0, (excepts))
85
86 #define test2_tol(func, y, x, result, tol, excepts) do {                \
87         volatile long double _iny = (y), _inx = (x), _out = (result);   \
88         assert(feclearexcept(FE_ALL_EXCEPT) == 0);                      \
89         assert(fpequal_tol(func(_iny, _inx), _out, (tol), CS_BOTH));    \
90         assert(((void)func, fetestexcept(ALL_STD_EXCEPT) == (excepts))); \
91 } while (0)
92 #define test2(func, y, x, result, excepts)                              \
93         test2_tol(func, (y), (x), (result), 0, (excepts))
94
95 #define _testall2_tol(prefix, y, x, result, tol, excepts) do {          \
96         test2_tol(prefix, (double)(y), (double)(x), (double)(result),   \
97                   (tol) * ldexp(1.0, 1 - DBL_MANT_DIG), (excepts));     \
98         test2_tol(prefix##f, (float)(y), (float)(x), (float)(result),   \
99                   (tol) * ldexpf(1.0, 1 - FLT_MANT_DIG), (excepts));    \
100 } while (0)
101
102 #if LDBL_PREC == 53
103 #define testall2_tol    _testall2_tol
104 #else
105 #define testall2_tol(prefix, y, x, result, tol, excepts) do {           \
106         _testall2_tol(prefix, y, x, result, tol, excepts);              \
107         test2_tol(prefix##l, (y), (x), (result),                        \
108                   (tol) * ldexpl(1.0, 1 - LDBL_MANT_DIG), (excepts));   \
109 } while (0)
110 #endif
111
112 #define testall2(prefix, y, x, result, excepts)                         \
113         testall2_tol(prefix, (y), (x), (result), 0, (excepts))
114
115 long double
116 pi =   3.14159265358979323846264338327950280e+00L,
117 pio3 = 1.04719755119659774615421446109316766e+00L,
118 c3pi = 9.42477796076937971538793014983850839e+00L,
119 c5pi = 1.57079632679489661923132169163975140e+01L,
120 c7pi = 2.19911485751285526692385036829565196e+01L,
121 c5pio3 = 5.23598775598298873077107230546583851e+00L,
122 sqrt2m1 = 4.14213562373095048801688724209698081e-01L;
123
124
125 /*
126  * Test special case inputs in asin(), acos() and atan(): signed
127  * zeroes, infinities, and NaNs.
128  */
129 static void
130 test_special(void)
131 {
132
133         testall(asin, 0.0, 0.0, 0);
134         testall(acos, 0.0, pi / 2, FE_INEXACT);
135         testall(atan, 0.0, 0.0, 0);
136         testall(asin, -0.0, -0.0, 0);
137         testall(acos, -0.0, pi / 2, FE_INEXACT);
138         testall(atan, -0.0, -0.0, 0);
139
140         testall(asin, INFINITY, NAN, FE_INVALID);
141         testall(acos, INFINITY, NAN, FE_INVALID);
142         testall(atan, INFINITY, pi / 2, FE_INEXACT);
143         testall(asin, -INFINITY, NAN, FE_INVALID);
144         testall(acos, -INFINITY, NAN, FE_INVALID);
145         testall(atan, -INFINITY, -pi / 2, FE_INEXACT);
146
147         testall(asin, NAN, NAN, 0);
148         testall(acos, NAN, NAN, 0);
149         testall(atan, NAN, NAN, 0);
150 }
151
152 /*
153  * Test special case inputs in atan2(), where the exact value of y/x is
154  * zero or non-finite.
155  */
156 static void
157 test_special_atan2(void)
158 {
159         long double z;
160         int e;
161
162         testall2(atan2, 0.0, -0.0, pi, FE_INEXACT);
163         testall2(atan2, -0.0, -0.0, -pi, FE_INEXACT);
164         testall2(atan2, 0.0, 0.0, 0.0, 0);
165         testall2(atan2, -0.0, 0.0, -0.0, 0);
166
167         testall2(atan2, INFINITY, -INFINITY, c3pi / 4, FE_INEXACT);
168         testall2(atan2, -INFINITY, -INFINITY, -c3pi / 4, FE_INEXACT);
169         testall2(atan2, INFINITY, INFINITY, pi / 4, FE_INEXACT);
170         testall2(atan2, -INFINITY, INFINITY, -pi / 4, FE_INEXACT);
171
172         /* Tests with one input in the range (0, Inf]. */
173         z = 1.23456789L;
174         for (e = FLT_MIN_EXP - FLT_MANT_DIG; e <= FLT_MAX_EXP; e++) {
175                 test2(atan2f, 0.0, ldexpf(z, e), 0.0, 0);
176                 test2(atan2f, -0.0, ldexpf(z, e), -0.0, 0);
177                 test2(atan2f, 0.0, ldexpf(-z, e), (float)pi, FE_INEXACT);
178                 test2(atan2f, -0.0, ldexpf(-z, e), (float)-pi, FE_INEXACT);
179                 test2(atan2f, ldexpf(z, e), 0.0, (float)pi / 2, FE_INEXACT);
180                 test2(atan2f, ldexpf(z, e), -0.0, (float)pi / 2, FE_INEXACT);
181                 test2(atan2f, ldexpf(-z, e), 0.0, (float)-pi / 2, FE_INEXACT);
182                 test2(atan2f, ldexpf(-z, e), -0.0, (float)-pi / 2, FE_INEXACT);
183         }
184         for (e = DBL_MIN_EXP - DBL_MANT_DIG; e <= DBL_MAX_EXP; e++) {
185                 test2(atan2, 0.0, ldexp(z, e), 0.0, 0);
186                 test2(atan2, -0.0, ldexp(z, e), -0.0, 0);
187                 test2(atan2, 0.0, ldexp(-z, e), (double)pi, FE_INEXACT);
188                 test2(atan2, -0.0, ldexp(-z, e), (double)-pi, FE_INEXACT);
189                 test2(atan2, ldexp(z, e), 0.0, (double)pi / 2, FE_INEXACT);
190                 test2(atan2, ldexp(z, e), -0.0, (double)pi / 2, FE_INEXACT);
191                 test2(atan2, ldexp(-z, e), 0.0, (double)-pi / 2, FE_INEXACT);
192                 test2(atan2, ldexp(-z, e), -0.0, (double)-pi / 2, FE_INEXACT);
193         }
194         for (e = LDBL_MIN_EXP - LDBL_MANT_DIG; e <= LDBL_MAX_EXP; e++) {
195                 test2(atan2l, 0.0, ldexpl(z, e), 0.0, 0);
196                 test2(atan2l, -0.0, ldexpl(z, e), -0.0, 0);
197                 test2(atan2l, 0.0, ldexpl(-z, e), pi, FE_INEXACT);
198                 test2(atan2l, -0.0, ldexpl(-z, e), -pi, FE_INEXACT);
199                 test2(atan2l, ldexpl(z, e), 0.0, pi / 2, FE_INEXACT);
200                 test2(atan2l, ldexpl(z, e), -0.0, pi / 2, FE_INEXACT);
201                 test2(atan2l, ldexpl(-z, e), 0.0, -pi / 2, FE_INEXACT);
202                 test2(atan2l, ldexpl(-z, e), -0.0, -pi / 2, FE_INEXACT);
203         }
204
205         /* Tests with one input in the range (0, Inf). */
206         for (e = FLT_MIN_EXP - FLT_MANT_DIG; e <= FLT_MAX_EXP - 1; e++) {
207                 test2(atan2f, ldexpf(z, e), INFINITY, 0.0, 0);
208                 test2(atan2f, ldexpf(-z,e), INFINITY, -0.0, 0);
209                 test2(atan2f, ldexpf(z, e), -INFINITY, (float)pi, FE_INEXACT);
210                 test2(atan2f, ldexpf(-z,e), -INFINITY, (float)-pi, FE_INEXACT);
211                 test2(atan2f, INFINITY, ldexpf(z,e), (float)pi/2, FE_INEXACT);
212                 test2(atan2f, INFINITY, ldexpf(-z,e), (float)pi/2, FE_INEXACT);
213                 test2(atan2f, -INFINITY, ldexpf(z,e), (float)-pi/2,FE_INEXACT);
214                 test2(atan2f, -INFINITY, ldexpf(-z,e),(float)-pi/2,FE_INEXACT);
215         }
216         for (e = DBL_MIN_EXP - DBL_MANT_DIG; e <= DBL_MAX_EXP - 1; e++) {
217                 test2(atan2, ldexp(z, e), INFINITY, 0.0, 0);
218                 test2(atan2, ldexp(-z,e), INFINITY, -0.0, 0);
219                 test2(atan2, ldexp(z, e), -INFINITY, (double)pi, FE_INEXACT);
220                 test2(atan2, ldexp(-z,e), -INFINITY, (double)-pi, FE_INEXACT);
221                 test2(atan2, INFINITY, ldexp(z,e), (double)pi/2, FE_INEXACT);
222                 test2(atan2, INFINITY, ldexp(-z,e), (double)pi/2, FE_INEXACT);
223                 test2(atan2, -INFINITY, ldexp(z,e), (double)-pi/2,FE_INEXACT);
224                 test2(atan2, -INFINITY, ldexp(-z,e),(double)-pi/2,FE_INEXACT);
225         }
226         for (e = LDBL_MIN_EXP - LDBL_MANT_DIG; e <= LDBL_MAX_EXP - 1; e++) {
227                 test2(atan2l, ldexpl(z, e), INFINITY, 0.0, 0);
228                 test2(atan2l, ldexpl(-z,e), INFINITY, -0.0, 0);
229                 test2(atan2l, ldexpl(z, e), -INFINITY, pi, FE_INEXACT);
230                 test2(atan2l, ldexpl(-z,e), -INFINITY, -pi, FE_INEXACT);
231                 test2(atan2l, INFINITY, ldexpl(z, e), pi / 2, FE_INEXACT);
232                 test2(atan2l, INFINITY, ldexpl(-z, e), pi / 2, FE_INEXACT);
233                 test2(atan2l, -INFINITY, ldexpl(z, e), -pi / 2, FE_INEXACT);
234                 test2(atan2l, -INFINITY, ldexpl(-z, e), -pi / 2, FE_INEXACT);
235         }
236 }
237
238 /*
239  * Test various inputs to asin(), acos() and atan() and verify that the
240  * results are accurate to within 1 ulp.
241  */
242 static void
243 test_accuracy(void)
244 {
245
246         /* We expect correctly rounded results for these basic cases. */
247         testall(asin, 1.0, pi / 2, FE_INEXACT);
248         testall(acos, 1.0, 0, 0);
249         testall(atan, 1.0, pi / 4, FE_INEXACT);
250         testall(asin, -1.0, -pi / 2, FE_INEXACT);
251         testall(acos, -1.0, pi, FE_INEXACT);
252         testall(atan, -1.0, -pi / 4, FE_INEXACT);
253
254         /*
255          * Here we expect answers to be within 1 ulp, although inexactness
256          * in the input, combined with double rounding, could cause larger
257          * errors.
258          */
259
260         testall_tol(asin, sqrtl(2) / 2, pi / 4, 1, FE_INEXACT);
261         testall_tol(acos, sqrtl(2) / 2, pi / 4, 1, FE_INEXACT);
262         testall_tol(asin, -sqrtl(2) / 2, -pi / 4, 1, FE_INEXACT);
263         testall_tol(acos, -sqrtl(2) / 2, c3pi / 4, 1, FE_INEXACT);
264
265         testall_tol(asin, sqrtl(3) / 2, pio3, 1, FE_INEXACT);
266         testall_tol(acos, sqrtl(3) / 2, pio3 / 2, 1, FE_INEXACT);
267         testall_tol(atan, sqrtl(3), pio3, 1, FE_INEXACT);
268         testall_tol(asin, -sqrtl(3) / 2, -pio3, 1, FE_INEXACT);
269         testall_tol(acos, -sqrtl(3) / 2, c5pio3 / 2, 1, FE_INEXACT);
270         testall_tol(atan, -sqrtl(3), -pio3, 1, FE_INEXACT);
271
272         testall_tol(atan, sqrt2m1, pi / 8, 1, FE_INEXACT);
273         testall_tol(atan, -sqrt2m1, -pi / 8, 1, FE_INEXACT);
274 }
275
276 /*
277  * Test inputs to atan2() where x is a power of 2. These are easy cases
278  * because y/x is exact.
279  */
280 static void
281 test_p2x_atan2(void)
282 {
283
284         testall2(atan2, 1.0, 1.0, pi / 4, FE_INEXACT);
285         testall2(atan2, 1.0, -1.0, c3pi / 4, FE_INEXACT);
286         testall2(atan2, -1.0, 1.0, -pi / 4, FE_INEXACT);
287         testall2(atan2, -1.0, -1.0, -c3pi / 4, FE_INEXACT);
288
289         testall2_tol(atan2, sqrt2m1 * 2, 2.0, pi / 8, 1, FE_INEXACT);
290         testall2_tol(atan2, sqrt2m1 * 2, -2.0, c7pi / 8, 1, FE_INEXACT);
291         testall2_tol(atan2, -sqrt2m1 * 2, 2.0, -pi / 8, 1, FE_INEXACT);
292         testall2_tol(atan2, -sqrt2m1 * 2, -2.0, -c7pi / 8, 1, FE_INEXACT);
293
294         testall2_tol(atan2, sqrtl(3) * 0.5, 0.5, pio3, 1, FE_INEXACT);
295         testall2_tol(atan2, sqrtl(3) * 0.5, -0.5, pio3 * 2, 1, FE_INEXACT);
296         testall2_tol(atan2, -sqrtl(3) * 0.5, 0.5, -pio3, 1, FE_INEXACT);
297         testall2_tol(atan2, -sqrtl(3) * 0.5, -0.5, -pio3 * 2, 1, FE_INEXACT);
298 }
299
300 /*
301  * Test inputs very close to 0.
302  */
303 static void
304 test_tiny(void)
305 {
306         float tiny = 0x1.23456p-120f;
307
308         testall(asin, tiny, tiny, FE_INEXACT);
309         testall(acos, tiny, pi / 2, FE_INEXACT);
310         testall(atan, tiny, tiny, FE_INEXACT);
311
312         testall(asin, -tiny, -tiny, FE_INEXACT);
313         testall(acos, -tiny, pi / 2, FE_INEXACT);
314         testall(atan, -tiny, -tiny, FE_INEXACT);
315
316         /* Test inputs to atan2() that would cause y/x to underflow. */
317         test2(atan2f, 0x1.0p-100, 0x1.0p100, 0.0, FE_INEXACT | FE_UNDERFLOW);
318         test2(atan2, 0x1.0p-1000, 0x1.0p1000, 0.0, FE_INEXACT | FE_UNDERFLOW);
319         test2(atan2l, ldexpl(1.0, 100 - LDBL_MAX_EXP),
320               ldexpl(1.0, LDBL_MAX_EXP - 100), 0.0, FE_INEXACT | FE_UNDERFLOW);
321         test2(atan2f, -0x1.0p-100, 0x1.0p100, -0.0, FE_INEXACT | FE_UNDERFLOW);
322         test2(atan2, -0x1.0p-1000, 0x1.0p1000, -0.0, FE_INEXACT | FE_UNDERFLOW);
323         test2(atan2l, -ldexpl(1.0, 100 - LDBL_MAX_EXP),
324               ldexpl(1.0, LDBL_MAX_EXP - 100), -0.0, FE_INEXACT | FE_UNDERFLOW);
325         test2(atan2f, 0x1.0p-100, -0x1.0p100, (float)pi, FE_INEXACT);
326         test2(atan2, 0x1.0p-1000, -0x1.0p1000, (double)pi, FE_INEXACT);
327         test2(atan2l, ldexpl(1.0, 100 - LDBL_MAX_EXP),
328               -ldexpl(1.0, LDBL_MAX_EXP - 100), pi, FE_INEXACT);
329         test2(atan2f, -0x1.0p-100, -0x1.0p100, (float)-pi, FE_INEXACT);
330         test2(atan2, -0x1.0p-1000, -0x1.0p1000, (double)-pi, FE_INEXACT);
331         test2(atan2l, -ldexpl(1.0, 100 - LDBL_MAX_EXP),
332               -ldexpl(1.0, LDBL_MAX_EXP - 100), -pi, FE_INEXACT);
333 }
334
335 /*
336  * Test very large inputs to atan().
337  */
338 static void
339 test_atan_huge(void)
340 {
341         float huge = 0x1.23456p120;
342
343         testall(atan, huge, pi / 2, FE_INEXACT);
344         testall(atan, -huge, -pi / 2, FE_INEXACT);
345
346         /* Test inputs to atan2() that would cause y/x to overflow. */
347         test2(atan2f, 0x1.0p100, 0x1.0p-100, (float)pi / 2, FE_INEXACT);
348         test2(atan2, 0x1.0p1000, 0x1.0p-1000, (double)pi / 2, FE_INEXACT);
349         test2(atan2l, ldexpl(1.0, LDBL_MAX_EXP - 100),
350               ldexpl(1.0, 100 - LDBL_MAX_EXP), pi / 2, FE_INEXACT);
351         test2(atan2f, -0x1.0p100, 0x1.0p-100, (float)-pi / 2, FE_INEXACT);
352         test2(atan2, -0x1.0p1000, 0x1.0p-1000, (double)-pi / 2, FE_INEXACT);
353         test2(atan2l, -ldexpl(1.0, LDBL_MAX_EXP - 100),
354               ldexpl(1.0, 100 - LDBL_MAX_EXP), -pi / 2, FE_INEXACT);
355
356         test2(atan2f, 0x1.0p100, -0x1.0p-100, (float)pi / 2, FE_INEXACT);
357         test2(atan2, 0x1.0p1000, -0x1.0p-1000, (double)pi / 2, FE_INEXACT);
358         test2(atan2l, ldexpl(1.0, LDBL_MAX_EXP - 100),
359               -ldexpl(1.0, 100 - LDBL_MAX_EXP), pi / 2, FE_INEXACT);
360         test2(atan2f, -0x1.0p100, -0x1.0p-100, (float)-pi / 2, FE_INEXACT);
361         test2(atan2, -0x1.0p1000, -0x1.0p-1000, (double)-pi / 2, FE_INEXACT);
362         test2(atan2l, -ldexpl(1.0, LDBL_MAX_EXP - 100),
363               -ldexpl(1.0, 100 - LDBL_MAX_EXP), -pi / 2, FE_INEXACT);
364 }
365
366 /*
367  * Test that sin(asin(x)) == x, and similarly for acos() and atan().
368  * You need to have a working sinl(), cosl(), and tanl() for these
369  * tests to pass.
370  */
371 static long double
372 sinasinf(float x)
373 {
374
375         return (sinl(asinf(x)));
376 }
377
378 static long double
379 sinasin(double x)
380 {
381
382         return (sinl(asin(x)));
383 }
384
385 static long double
386 sinasinl(long double x)
387 {
388
389         return (sinl(asinl(x)));
390 }
391
392 static long double
393 cosacosf(float x)
394 {
395
396         return (cosl(acosf(x)));
397 }
398
399 static long double
400 cosacos(double x)
401 {
402
403         return (cosl(acos(x)));
404 }
405
406 static long double
407 cosacosl(long double x)
408 {
409
410         return (cosl(acosl(x)));
411 }
412
413 static long double
414 tanatanf(float x)
415 {
416
417         return (tanl(atanf(x)));
418 }
419
420 static long double
421 tanatan(double x)
422 {
423
424         return (tanl(atan(x)));
425 }
426
427 static long double
428 tanatanl(long double x)
429 {
430
431         return (tanl(atanl(x)));
432 }
433
434 static void
435 test_inverse(void)
436 {
437         float i;
438
439         for (i = -1; i <= 1; i += 0x1.0p-12f) {
440                 testall_tol(sinasin, i, i, 2, i == 0 ? 0 : FE_INEXACT);
441                 /* The relative error for cosacos is very large near x=0. */
442                 if (fabsf(i) > 0x1.0p-4f)
443                         testall_tol(cosacos, i, i, 16, i == 1 ? 0 : FE_INEXACT);
444                 testall_tol(tanatan, i, i, 2, i == 0 ? 0 : FE_INEXACT);
445         }
446 }
447
448 int
449 main(int argc, char *argv[])
450 {
451
452 #if defined(__i386__)
453         printf("1..0 # SKIP fails all assertions on i386\n");
454         return (0);
455 #endif
456
457         printf("1..7\n");
458
459         test_special();
460         printf("ok 1 - special\n");
461
462         test_special_atan2();
463         printf("ok 2 - atan2 special\n");
464
465         test_accuracy();
466         printf("ok 3 - accuracy\n");
467
468         test_p2x_atan2();
469         printf("ok 4 - atan2 p2x\n");
470
471         test_tiny();
472         printf("ok 5 - tiny inputs\n");
473
474         test_atan_huge();
475         printf("ok 6 - atan huge inputs\n");
476
477         test_inverse();
478         printf("ok 7 - inverse\n");
479
480         return (0);
481 }