1/* Test ctan.
2   Copyright (C) 1997-2022 Free Software Foundation, Inc.
3   This file is part of the GNU C Library.
4
5   The GNU C Library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9
10   The GNU C Library is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   Lesser General Public License for more details.
14
15   You should have received a copy of the GNU Lesser General Public
16   License along with the GNU C Library; if not, see
17   <https://www.gnu.org/licenses/>.  */
18
19#include "libm-test-driver.c"
20
21static const struct test_c_c_data ctan_test_data[] =
22  {
23    TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0),
24    TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0),
25    TEST_c_c (ctan, 2, plus_infty, minus_zero, 1.0),
26    TEST_c_c (ctan, 3, plus_infty, minus_zero, 1.0),
27    TEST_c_c (ctan, 4, plus_infty, 0.0, 1.0),
28    TEST_c_c (ctan, min_value, plus_infty, 0.0, 1.0),
29    TEST_c_c (ctan, min_subnorm_value, plus_infty, 0.0, 1.0),
30    TEST_c_c (ctan, 0x1p127, plus_infty, 0.0, 1.0),
31    TEST_c_c (ctan, 0x1.11p127, plus_infty, minus_zero, 1.0),
32#if !TEST_COND_binary32
33    TEST_c_c (ctan, 0x1p1023, plus_infty, minus_zero, 1.0),
34    TEST_c_c (ctan, 0x1.5p1023, plus_infty, 0.0, 1.0),
35#endif
36#if MAX_EXP >= 16384
37    TEST_c_c (ctan, 0x1p16383L, plus_infty, 0.0, 1.0),
38    TEST_c_c (ctan, 0x1.2p16383L, plus_infty, minus_zero, 1.0),
39#endif
40    TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0),
41    TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0),
42    TEST_c_c (ctan, -2, plus_infty, 0.0, 1.0),
43    TEST_c_c (ctan, -3, plus_infty, 0.0, 1.0),
44    TEST_c_c (ctan, -4, plus_infty, minus_zero, 1.0),
45    TEST_c_c (ctan, -min_value, plus_infty, minus_zero, 1.0),
46    TEST_c_c (ctan, -min_subnorm_value, plus_infty, minus_zero, 1.0),
47    TEST_c_c (ctan, -0x1p127, plus_infty, minus_zero, 1.0),
48    TEST_c_c (ctan, -0x1.11p127, plus_infty, 0.0, 1.0),
49#if !TEST_COND_binary32
50    TEST_c_c (ctan, -0x1p1023, plus_infty, 0.0, 1.0),
51    TEST_c_c (ctan, -0x1.5p1023, plus_infty, minus_zero, 1.0),
52#endif
53#if MAX_EXP >= 16384
54    TEST_c_c (ctan, -0x1p16383L, plus_infty, minus_zero, 1.0),
55    TEST_c_c (ctan, -0x1.2p16383L, plus_infty, 0.0, 1.0),
56#endif
57
58    TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0),
59    TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0),
60    TEST_c_c (ctan, 2, minus_infty, minus_zero, -1.0),
61    TEST_c_c (ctan, 3, minus_infty, minus_zero, -1.0),
62    TEST_c_c (ctan, 4, minus_infty, 0.0, -1.0),
63    TEST_c_c (ctan, min_value, minus_infty, 0.0, -1.0),
64    TEST_c_c (ctan, min_subnorm_value, minus_infty, 0.0, -1.0),
65    TEST_c_c (ctan, 0x1p127, minus_infty, 0.0, -1.0),
66    TEST_c_c (ctan, 0x1.11p127, minus_infty, minus_zero, -1.0),
67#if !TEST_COND_binary32
68    TEST_c_c (ctan, 0x1p1023, minus_infty, minus_zero, -1.0),
69    TEST_c_c (ctan, 0x1.5p1023, minus_infty, 0.0, -1.0),
70#endif
71#if MAX_EXP >= 16384
72    TEST_c_c (ctan, 0x1p16383L, minus_infty, 0.0, -1.0),
73    TEST_c_c (ctan, 0x1.2p16383L, minus_infty, minus_zero, -1.0),
74#endif
75    TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0),
76    TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0),
77    TEST_c_c (ctan, -2, minus_infty, 0.0, -1.0),
78    TEST_c_c (ctan, -3, minus_infty, 0.0, -1.0),
79    TEST_c_c (ctan, -4, minus_infty, minus_zero, -1.0),
80    TEST_c_c (ctan, -min_value, minus_infty, minus_zero, -1.0),
81    TEST_c_c (ctan, -min_subnorm_value, minus_infty, minus_zero, -1.0),
82    TEST_c_c (ctan, -0x1p127, minus_infty, minus_zero, -1.0),
83    TEST_c_c (ctan, -0x1.11p127, minus_infty, 0.0, -1.0),
84#if !TEST_COND_binary32
85    TEST_c_c (ctan, -0x1p1023, minus_infty, 0.0, -1.0),
86    TEST_c_c (ctan, -0x1.5p1023, minus_infty, minus_zero, -1.0),
87#endif
88#if MAX_EXP >= 16384
89    TEST_c_c (ctan, -0x1p16383L, minus_infty, minus_zero, -1.0),
90    TEST_c_c (ctan, -0x1.2p16383L, minus_infty, 0.0, -1.0),
91#endif
92
93    TEST_c_c (ctan, plus_infty, 0, qnan_value, 0, INVALID_EXCEPTION),
94    TEST_c_c (ctan, plus_infty, 2, qnan_value, qnan_value, INVALID_EXCEPTION),
95    TEST_c_c (ctan, minus_infty, 0, qnan_value, 0, INVALID_EXCEPTION),
96    TEST_c_c (ctan, minus_infty, 2, qnan_value, qnan_value, INVALID_EXCEPTION),
97    TEST_c_c (ctan, plus_infty, minus_zero, qnan_value, minus_zero, INVALID_EXCEPTION),
98    TEST_c_c (ctan, plus_infty, -2, qnan_value, qnan_value, INVALID_EXCEPTION),
99    TEST_c_c (ctan, minus_infty, minus_zero, qnan_value, minus_zero, INVALID_EXCEPTION),
100    TEST_c_c (ctan, minus_infty, -2, qnan_value, qnan_value, INVALID_EXCEPTION),
101
102    TEST_c_c (ctan, qnan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN),
103    TEST_c_c (ctan, plus_infty, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN),
104    TEST_c_c (ctan, minus_infty, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN),
105    TEST_c_c (ctan, qnan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN),
106    TEST_c_c (ctan, plus_infty, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN),
107    TEST_c_c (ctan, minus_infty, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN),
108
109    TEST_c_c (ctan, 0, qnan_value, 0.0, qnan_value),
110    TEST_c_c (ctan, minus_zero, qnan_value, minus_zero, qnan_value),
111
112    TEST_c_c (ctan, 0.5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
113    TEST_c_c (ctan, -4.5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
114
115    TEST_c_c (ctan, qnan_value, 0, qnan_value, 0),
116    TEST_c_c (ctan, qnan_value, 5, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
117    TEST_c_c (ctan, qnan_value, minus_zero, qnan_value, minus_zero),
118    TEST_c_c (ctan, qnan_value, -0.25, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
119
120    TEST_c_c (ctan, qnan_value, qnan_value, qnan_value, qnan_value),
121
122    AUTO_TESTS_c_c (ctan),
123  };
124
125static void
126ctan_test (void)
127{
128  ALL_RM_TEST (ctan, 0, ctan_test_data, RUN_TEST_LOOP_c_c, END_COMPLEX);
129}
130
131static void
132do_test (void)
133{
134  ctan_test ();
135}
136
137/*
138 * Local Variables:
139 * mode:c
140 * End:
141 */
142