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 * $FreeBSD: src/tools/regression/lib/msun/test-invtrig.c,v 1.3 2010/12/06 00:02:49 das Exp $
27 */
28
29 /*
30 * Tests for corner cases in the inverse trigonometric functions. Some
31 * accuracy tests are included as well, but these are very basic
32 * sanity checks, not intended to be comprehensive.
33 */
34
35 #include <assert.h>
36 #include <fenv.h>
37 #include <float.h>
38 #include <math.h>
39 #include <stdio.h>
40
41 #define ALL_STD_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \
42 FE_OVERFLOW | FE_UNDERFLOW)
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(func(_in), _out, (tol))); \
61 assert((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 test_tol(prefix##l, (x), (result), \
72 (tol) * ldexpl(1.0, 1 - LDBL_MANT_DIG), (excepts)); \
73 } while (0)
74 #define testall(prefix, x, result, excepts) \
75 testall_tol(prefix, (x), (result), 0, (excepts))
76
77 #define test2_tol(func, y, x, result, tol, excepts) do { \
78 volatile long double _iny = (y), _inx = (x), _out = (result); \
79 assert(feclearexcept(FE_ALL_EXCEPT) == 0); \
80 assert(fpequal(func(_iny, _inx), _out, (tol))); \
81 assert((func, fetestexcept(ALL_STD_EXCEPT) == (excepts))); \
82 } while (0)
83 #define test2(func, y, x, result, excepts) \
84 test2_tol(func, (y), (x), (result), 0, (excepts))
85
86 #define testall2_tol(prefix, y, x, result, tol, excepts) do { \
87 test2_tol(prefix, (double)(y), (double)(x), (double)(result), \
88 (tol) * ldexp(1.0, 1 - DBL_MANT_DIG), (excepts)); \
89 test2_tol(prefix##f, (float)(y), (float)(x), (float)(result), \
90 (tol) * ldexpf(1.0, 1 - FLT_MANT_DIG), (excepts)); \
91 test2_tol(prefix##l, (y), (x), (result), \
92 (tol) * ldexpl(1.0, 1 - LDBL_MANT_DIG), (excepts)); \
93 } while (0)
94 #define testall2(prefix, y, x, result, excepts) \
95 testall2_tol(prefix, (y), (x), (result), 0, (excepts))
96
97 long double
98 pi = 3.14159265358979323846264338327950280e+00L,
99 pio3 = 1.04719755119659774615421446109316766e+00L,
100 c3pi = 9.42477796076937971538793014983850839e+00L,
101 c5pi = 1.57079632679489661923132169163975140e+01L,
102 c7pi = 2.19911485751285526692385036829565196e+01L,
103 c5pio3 = 5.23598775598298873077107230546583851e+00L,
104 sqrt2m1 = 4.14213562373095048801688724209698081e-01L;
105
106 /*
107 * Determine whether x and y are equal to within a relative error of tol,
108 * with two special rules:
109 * +0.0 != -0.0
110 * NaN == NaN
111 */
112 int
fpequal(long double x,long double y,long double tol)113 fpequal(long double x, long double y, long double tol)
114 {
115 fenv_t env;
116 int ret;
117
118 if (isnan(x) && isnan(y))
119 return (1);
120 if (!signbit(x) != !signbit(y))
121 return (0);
122 if (x == y)
123 return (1);
124 if (tol == 0)
125 return (0);
126
127 /* Hard case: need to check the tolerance. */
128 feholdexcept(&env);
129 ret = fabsl(x - y) <= fabsl(y * tol);
130 fesetenv(&env);
131 return (ret);
132 }
133
134 /*
135 * Test special case inputs in asin(), acos() and atan(): signed
136 * zeroes, infinities, and NaNs.
137 */
138 static void
test_special(void)139 test_special(void)
140 {
141
142 testall(asin, 0.0, 0.0, 0);
143 testall(acos, 0.0, pi / 2, FE_INEXACT);
144 testall(atan, 0.0, 0.0, 0);
145 testall(asin, -0.0, -0.0, 0);
146 testall(acos, -0.0, pi / 2, FE_INEXACT);
147 testall(atan, -0.0, -0.0, 0);
148
149 testall(asin, INFINITY, NAN, FE_INVALID);
150 testall(acos, INFINITY, NAN, FE_INVALID);
151 testall(atan, INFINITY, pi / 2, FE_INEXACT);
152 testall(asin, -INFINITY, NAN, FE_INVALID);
153 testall(acos, -INFINITY, NAN, FE_INVALID);
154 testall(atan, -INFINITY, -pi / 2, FE_INEXACT);
155
156 testall(asin, NAN, NAN, 0);
157 testall(acos, NAN, NAN, 0);
158 testall(atan, NAN, NAN, 0);
159 }
160
161 /*
162 * Test special case inputs in atan2(), where the exact value of y/x is
163 * zero or non-finite.
164 */
165 static void
test_special_atan2(void)166 test_special_atan2(void)
167 {
168 long double z;
169 int e;
170
171 testall2(atan2, 0.0, -0.0, pi, FE_INEXACT);
172 testall2(atan2, -0.0, -0.0, -pi, FE_INEXACT);
173 testall2(atan2, 0.0, 0.0, 0.0, 0);
174 testall2(atan2, -0.0, 0.0, -0.0, 0);
175
176 testall2(atan2, INFINITY, -INFINITY, c3pi / 4, FE_INEXACT);
177 testall2(atan2, -INFINITY, -INFINITY, -c3pi / 4, FE_INEXACT);
178 testall2(atan2, INFINITY, INFINITY, pi / 4, FE_INEXACT);
179 testall2(atan2, -INFINITY, INFINITY, -pi / 4, FE_INEXACT);
180
181 /* Tests with one input in the range (0, Inf]. */
182 z = 1.23456789L;
183 for (e = FLT_MIN_EXP - FLT_MANT_DIG; e <= FLT_MAX_EXP; e++) {
184 test2(atan2f, 0.0, ldexpf(z, e), 0.0, 0);
185 test2(atan2f, -0.0, ldexpf(z, e), -0.0, 0);
186 test2(atan2f, 0.0, ldexpf(-z, e), (float)pi, FE_INEXACT);
187 test2(atan2f, -0.0, ldexpf(-z, e), (float)-pi, FE_INEXACT);
188 test2(atan2f, ldexpf(z, e), 0.0, (float)pi / 2, FE_INEXACT);
189 test2(atan2f, ldexpf(z, e), -0.0, (float)pi / 2, FE_INEXACT);
190 test2(atan2f, ldexpf(-z, e), 0.0, (float)-pi / 2, FE_INEXACT);
191 test2(atan2f, ldexpf(-z, e), -0.0, (float)-pi / 2, FE_INEXACT);
192 }
193 for (e = DBL_MIN_EXP - DBL_MANT_DIG; e <= DBL_MAX_EXP; e++) {
194 test2(atan2, 0.0, ldexp(z, e), 0.0, 0);
195 test2(atan2, -0.0, ldexp(z, e), -0.0, 0);
196 test2(atan2, 0.0, ldexp(-z, e), (double)pi, FE_INEXACT);
197 test2(atan2, -0.0, ldexp(-z, e), (double)-pi, FE_INEXACT);
198 test2(atan2, ldexp(z, e), 0.0, (double)pi / 2, FE_INEXACT);
199 test2(atan2, ldexp(z, e), -0.0, (double)pi / 2, FE_INEXACT);
200 test2(atan2, ldexp(-z, e), 0.0, (double)-pi / 2, FE_INEXACT);
201 test2(atan2, ldexp(-z, e), -0.0, (double)-pi / 2, FE_INEXACT);
202 }
203 for (e = LDBL_MIN_EXP - LDBL_MANT_DIG; e <= LDBL_MAX_EXP; e++) {
204 test2(atan2l, 0.0, ldexpl(z, e), 0.0, 0);
205 test2(atan2l, -0.0, ldexpl(z, e), -0.0, 0);
206 test2(atan2l, 0.0, ldexpl(-z, e), pi, FE_INEXACT);
207 test2(atan2l, -0.0, ldexpl(-z, e), -pi, FE_INEXACT);
208 test2(atan2l, ldexpl(z, e), 0.0, pi / 2, FE_INEXACT);
209 test2(atan2l, ldexpl(z, e), -0.0, pi / 2, FE_INEXACT);
210 test2(atan2l, ldexpl(-z, e), 0.0, -pi / 2, FE_INEXACT);
211 test2(atan2l, ldexpl(-z, e), -0.0, -pi / 2, FE_INEXACT);
212 }
213
214 /* Tests with one input in the range (0, Inf). */
215 for (e = FLT_MIN_EXP - FLT_MANT_DIG; e <= FLT_MAX_EXP - 1; e++) {
216 test2(atan2f, ldexpf(z, e), INFINITY, 0.0, 0);
217 test2(atan2f, ldexpf(-z,e), INFINITY, -0.0, 0);
218 test2(atan2f, ldexpf(z, e), -INFINITY, (float)pi, FE_INEXACT);
219 test2(atan2f, ldexpf(-z,e), -INFINITY, (float)-pi, FE_INEXACT);
220 test2(atan2f, INFINITY, ldexpf(z,e), (float)pi/2, FE_INEXACT);
221 test2(atan2f, INFINITY, ldexpf(-z,e), (float)pi/2, FE_INEXACT);
222 test2(atan2f, -INFINITY, ldexpf(z,e), (float)-pi/2,FE_INEXACT);
223 test2(atan2f, -INFINITY, ldexpf(-z,e),(float)-pi/2,FE_INEXACT);
224 }
225 for (e = DBL_MIN_EXP - DBL_MANT_DIG; e <= DBL_MAX_EXP - 1; e++) {
226 test2(atan2, ldexp(z, e), INFINITY, 0.0, 0);
227 test2(atan2, ldexp(-z,e), INFINITY, -0.0, 0);
228 test2(atan2, ldexp(z, e), -INFINITY, (double)pi, FE_INEXACT);
229 test2(atan2, ldexp(-z,e), -INFINITY, (double)-pi, FE_INEXACT);
230 test2(atan2, INFINITY, ldexp(z,e), (double)pi/2, FE_INEXACT);
231 test2(atan2, INFINITY, ldexp(-z,e), (double)pi/2, FE_INEXACT);
232 test2(atan2, -INFINITY, ldexp(z,e), (double)-pi/2,FE_INEXACT);
233 test2(atan2, -INFINITY, ldexp(-z,e),(double)-pi/2,FE_INEXACT);
234 }
235 for (e = LDBL_MIN_EXP - LDBL_MANT_DIG; e <= LDBL_MAX_EXP - 1; e++) {
236 test2(atan2l, ldexpl(z, e), INFINITY, 0.0, 0);
237 test2(atan2l, ldexpl(-z,e), INFINITY, -0.0, 0);
238 test2(atan2l, ldexpl(z, e), -INFINITY, pi, FE_INEXACT);
239 test2(atan2l, ldexpl(-z,e), -INFINITY, -pi, FE_INEXACT);
240 test2(atan2l, INFINITY, ldexpl(z, e), pi / 2, FE_INEXACT);
241 test2(atan2l, INFINITY, ldexpl(-z, e), pi / 2, FE_INEXACT);
242 test2(atan2l, -INFINITY, ldexpl(z, e), -pi / 2, FE_INEXACT);
243 test2(atan2l, -INFINITY, ldexpl(-z, e), -pi / 2, FE_INEXACT);
244 }
245 }
246
247 /*
248 * Test various inputs to asin(), acos() and atan() and verify that the
249 * results are accurate to within 1 ulp.
250 */
251 static void
test_accuracy(void)252 test_accuracy(void)
253 {
254
255 /* We expect correctly rounded results for these basic cases. */
256 testall(asin, 1.0, pi / 2, FE_INEXACT);
257 testall(acos, 1.0, 0, 0);
258 testall(atan, 1.0, pi / 4, FE_INEXACT);
259 testall(asin, -1.0, -pi / 2, FE_INEXACT);
260 testall(acos, -1.0, pi, FE_INEXACT);
261 testall(atan, -1.0, -pi / 4, FE_INEXACT);
262
263 /*
264 * Here we expect answers to be within 1 ulp, although inexactness
265 * in the input, combined with double rounding, could cause larger
266 * errors.
267 */
268
269 testall_tol(asin, sqrtl(2) / 2, pi / 4, 1, FE_INEXACT);
270 testall_tol(acos, sqrtl(2) / 2, pi / 4, 1, FE_INEXACT);
271 testall_tol(asin, -sqrtl(2) / 2, -pi / 4, 1, FE_INEXACT);
272 testall_tol(acos, -sqrtl(2) / 2, c3pi / 4, 1, FE_INEXACT);
273
274 testall_tol(asin, sqrtl(3) / 2, pio3, 1, FE_INEXACT);
275 testall_tol(acos, sqrtl(3) / 2, pio3 / 2, 1, FE_INEXACT);
276 testall_tol(atan, sqrtl(3), pio3, 1, FE_INEXACT);
277 testall_tol(asin, -sqrtl(3) / 2, -pio3, 1, FE_INEXACT);
278 testall_tol(acos, -sqrtl(3) / 2, c5pio3 / 2, 1, FE_INEXACT);
279 testall_tol(atan, -sqrtl(3), -pio3, 1, FE_INEXACT);
280
281 testall_tol(atan, sqrt2m1, pi / 8, 1, FE_INEXACT);
282 testall_tol(atan, -sqrt2m1, -pi / 8, 1, FE_INEXACT);
283 }
284
285 /*
286 * Test inputs to atan2() where x is a power of 2. These are easy cases
287 * because y/x is exact.
288 */
289 static void
test_p2x_atan2(void)290 test_p2x_atan2(void)
291 {
292
293 testall2(atan2, 1.0, 1.0, pi / 4, FE_INEXACT);
294 testall2(atan2, 1.0, -1.0, c3pi / 4, FE_INEXACT);
295 testall2(atan2, -1.0, 1.0, -pi / 4, FE_INEXACT);
296 testall2(atan2, -1.0, -1.0, -c3pi / 4, FE_INEXACT);
297
298 testall2_tol(atan2, sqrt2m1 * 2, 2.0, pi / 8, 1, FE_INEXACT);
299 testall2_tol(atan2, sqrt2m1 * 2, -2.0, c7pi / 8, 1, FE_INEXACT);
300 testall2_tol(atan2, -sqrt2m1 * 2, 2.0, -pi / 8, 1, FE_INEXACT);
301 testall2_tol(atan2, -sqrt2m1 * 2, -2.0, -c7pi / 8, 1, FE_INEXACT);
302
303 testall2_tol(atan2, sqrtl(3) * 0.5, 0.5, pio3, 1, FE_INEXACT);
304 testall2_tol(atan2, sqrtl(3) * 0.5, -0.5, pio3 * 2, 1, FE_INEXACT);
305 testall2_tol(atan2, -sqrtl(3) * 0.5, 0.5, -pio3, 1, FE_INEXACT);
306 testall2_tol(atan2, -sqrtl(3) * 0.5, -0.5, -pio3 * 2, 1, FE_INEXACT);
307 }
308
309 /*
310 * Test inputs very close to 0.
311 */
312 static void
test_tiny(void)313 test_tiny(void)
314 {
315 float tiny = 0x1.23456p-120f;
316
317 testall(asin, tiny, tiny, FE_INEXACT);
318 testall(acos, tiny, pi / 2, FE_INEXACT);
319 testall(atan, tiny, tiny, FE_INEXACT);
320
321 testall(asin, -tiny, -tiny, FE_INEXACT);
322 testall(acos, -tiny, pi / 2, FE_INEXACT);
323 testall(atan, -tiny, -tiny, FE_INEXACT);
324
325 /* Test inputs to atan2() that would cause y/x to underflow. */
326 test2(atan2f, 0x1.0p-100, 0x1.0p100, 0.0, FE_INEXACT | FE_UNDERFLOW);
327 test2(atan2, 0x1.0p-1000, 0x1.0p1000, 0.0, FE_INEXACT | FE_UNDERFLOW);
328 test2(atan2l, ldexpl(1.0, 100 - LDBL_MAX_EXP),
329 ldexpl(1.0, LDBL_MAX_EXP - 100), 0.0, FE_INEXACT | FE_UNDERFLOW);
330 test2(atan2f, -0x1.0p-100, 0x1.0p100, -0.0, FE_INEXACT | FE_UNDERFLOW);
331 test2(atan2, -0x1.0p-1000, 0x1.0p1000, -0.0, FE_INEXACT | FE_UNDERFLOW);
332 test2(atan2l, -ldexpl(1.0, 100 - LDBL_MAX_EXP),
333 ldexpl(1.0, LDBL_MAX_EXP - 100), -0.0, FE_INEXACT | FE_UNDERFLOW);
334 test2(atan2f, 0x1.0p-100, -0x1.0p100, (float)pi, FE_INEXACT);
335 test2(atan2, 0x1.0p-1000, -0x1.0p1000, (double)pi, FE_INEXACT);
336 test2(atan2l, ldexpl(1.0, 100 - LDBL_MAX_EXP),
337 -ldexpl(1.0, LDBL_MAX_EXP - 100), pi, FE_INEXACT);
338 test2(atan2f, -0x1.0p-100, -0x1.0p100, (float)-pi, FE_INEXACT);
339 test2(atan2, -0x1.0p-1000, -0x1.0p1000, (double)-pi, FE_INEXACT);
340 test2(atan2l, -ldexpl(1.0, 100 - LDBL_MAX_EXP),
341 -ldexpl(1.0, LDBL_MAX_EXP - 100), -pi, FE_INEXACT);
342 }
343
344 /*
345 * Test very large inputs to atan().
346 */
347 static void
test_atan_huge(void)348 test_atan_huge(void)
349 {
350 float huge = 0x1.23456p120;
351
352 testall(atan, huge, pi / 2, FE_INEXACT);
353 testall(atan, -huge, -pi / 2, FE_INEXACT);
354
355 /* Test inputs to atan2() that would cause y/x to overflow. */
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 test2(atan2f, 0x1.0p100, -0x1.0p-100, (float)pi / 2, FE_INEXACT);
366 test2(atan2, 0x1.0p1000, -0x1.0p-1000, (double)pi / 2, FE_INEXACT);
367 test2(atan2l, ldexpl(1.0, LDBL_MAX_EXP - 100),
368 -ldexpl(1.0, 100 - LDBL_MAX_EXP), pi / 2, FE_INEXACT);
369 test2(atan2f, -0x1.0p100, -0x1.0p-100, (float)-pi / 2, FE_INEXACT);
370 test2(atan2, -0x1.0p1000, -0x1.0p-1000, (double)-pi / 2, FE_INEXACT);
371 test2(atan2l, -ldexpl(1.0, LDBL_MAX_EXP - 100),
372 -ldexpl(1.0, 100 - LDBL_MAX_EXP), -pi / 2, FE_INEXACT);
373 }
374
375 /*
376 * Test that sin(asin(x)) == x, and similarly for acos() and atan().
377 * You need to have a working sinl(), cosl(), and tanl() for these
378 * tests to pass.
379 */
380 static long double
sinasinf(float x)381 sinasinf(float x)
382 {
383
384 return (sinl(asinf(x)));
385 }
386
387 static long double
sinasin(double x)388 sinasin(double x)
389 {
390
391 return (sinl(asin(x)));
392 }
393
394 static long double
sinasinl(long double x)395 sinasinl(long double x)
396 {
397
398 return (sinl(asinl(x)));
399 }
400
401 static long double
cosacosf(float x)402 cosacosf(float x)
403 {
404
405 return (cosl(acosf(x)));
406 }
407
408 static long double
cosacos(double x)409 cosacos(double x)
410 {
411
412 return (cosl(acos(x)));
413 }
414
415 static long double
cosacosl(long double x)416 cosacosl(long double x)
417 {
418
419 return (cosl(acosl(x)));
420 }
421
422 static long double
tanatanf(float x)423 tanatanf(float x)
424 {
425
426 return (tanl(atanf(x)));
427 }
428
429 static long double
tanatan(double x)430 tanatan(double x)
431 {
432
433 return (tanl(atan(x)));
434 }
435
436 static long double
tanatanl(long double x)437 tanatanl(long double x)
438 {
439
440 return (tanl(atanl(x)));
441 }
442
443 static void
test_inverse(void)444 test_inverse(void)
445 {
446 float i;
447
448 for (i = -1; i <= 1; i += 0x1.0p-12f) {
449 testall_tol(sinasin, i, i, 2, i == 0 ? 0 : FE_INEXACT);
450 /* The relative error for cosacos is very large near x=0. */
451 if (fabsf(i) > 0x1.0p-4f)
452 testall_tol(cosacos, i, i, 16, i == 1 ? 0 : FE_INEXACT);
453 testall_tol(tanatan, i, i, 2, i == 0 ? 0 : FE_INEXACT);
454 }
455 }
456
457 int
main(int argc,char * argv[])458 main(int argc, char *argv[])
459 {
460
461 printf("1..7\n");
462
463 test_special();
464 printf("ok 1 - special\n");
465
466 test_special_atan2();
467 printf("ok 2 - atan2 special\n");
468
469 test_accuracy();
470 printf("ok 3 - accuracy\n");
471
472 test_p2x_atan2();
473 printf("ok 4 - atan2 p2x\n");
474
475 test_tiny();
476 printf("ok 5 - tiny inputs\n");
477
478 test_atan_huge();
479 printf("ok 6 - atan huge inputs\n");
480
481 test_inverse();
482 printf("ok 7 - inverse\n");
483
484 return (0);
485 }
486