1/* Test pow.
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_ff_f_data pow_test_data[] =
22  {
23    TEST_ff_f (pow, qnan_value, 0, 1, ERRNO_UNCHANGED|NO_TEST_MATHVEC),
24    TEST_ff_f (pow, -qnan_value, 0, 1, ERRNO_UNCHANGED|NO_TEST_MATHVEC),
25    TEST_ff_f (pow, qnan_value, minus_zero, 1, ERRNO_UNCHANGED|NO_TEST_MATHVEC),
26    TEST_ff_f (pow, -qnan_value, minus_zero, 1, ERRNO_UNCHANGED|NO_TEST_MATHVEC),
27    TEST_ff_f (pow, snan_value, 0, qnan_value, INVALID_EXCEPTION|NO_TEST_MATHVEC),
28    TEST_ff_f (pow, -snan_value, 0, qnan_value, INVALID_EXCEPTION|NO_TEST_MATHVEC),
29    TEST_ff_f (pow, snan_value, minus_zero, qnan_value, INVALID_EXCEPTION|NO_TEST_MATHVEC),
30    TEST_ff_f (pow, -snan_value, minus_zero, qnan_value, INVALID_EXCEPTION|NO_TEST_MATHVEC),
31
32    TEST_ff_f (pow, 1.1L, plus_infty, plus_infty, ERRNO_UNCHANGED),
33    TEST_ff_f (pow, plus_infty, plus_infty, plus_infty, ERRNO_UNCHANGED),
34    TEST_ff_f (pow, -1.1L, plus_infty, plus_infty, ERRNO_UNCHANGED),
35    TEST_ff_f (pow, minus_infty, plus_infty, plus_infty, ERRNO_UNCHANGED),
36
37    TEST_ff_f (pow, 0.9L, plus_infty, 0, ERRNO_UNCHANGED),
38    TEST_ff_f (pow, 1e-7L, plus_infty, 0, ERRNO_UNCHANGED),
39    TEST_ff_f (pow, -0.9L, plus_infty, 0, ERRNO_UNCHANGED),
40    TEST_ff_f (pow, -1e-7L, plus_infty, 0, ERRNO_UNCHANGED),
41
42    TEST_ff_f (pow, 1.1L, minus_infty, 0, ERRNO_UNCHANGED),
43    TEST_ff_f (pow, plus_infty, minus_infty, 0, ERRNO_UNCHANGED),
44    TEST_ff_f (pow, -1.1L, minus_infty, 0, ERRNO_UNCHANGED),
45    TEST_ff_f (pow, minus_infty, minus_infty, 0, ERRNO_UNCHANGED),
46
47    TEST_ff_f (pow, 0.9L, minus_infty, plus_infty, ERRNO_UNCHANGED),
48    TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty, ERRNO_UNCHANGED),
49    TEST_ff_f (pow, -0.9L, minus_infty, plus_infty, ERRNO_UNCHANGED),
50    TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty, ERRNO_UNCHANGED),
51
52    TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty, ERRNO_UNCHANGED),
53    TEST_ff_f (pow, plus_infty, 1, plus_infty, ERRNO_UNCHANGED),
54    TEST_ff_f (pow, plus_infty, 1e7L, plus_infty, ERRNO_UNCHANGED),
55    TEST_ff_f (pow, plus_infty, min_subnorm_value, plus_infty, ERRNO_UNCHANGED),
56
57    TEST_ff_f (pow, plus_infty, -1e-7L, 0, ERRNO_UNCHANGED),
58    TEST_ff_f (pow, plus_infty, -1, 0, ERRNO_UNCHANGED),
59    TEST_ff_f (pow, plus_infty, -1e7L, 0, ERRNO_UNCHANGED),
60    TEST_ff_f (pow, plus_infty, -min_subnorm_value, 0, ERRNO_UNCHANGED),
61
62    TEST_ff_f (pow, minus_infty, 1, minus_infty, ERRNO_UNCHANGED),
63    TEST_ff_f (pow, minus_infty, 11, minus_infty, ERRNO_UNCHANGED),
64    TEST_ff_f (pow, minus_infty, 1001, minus_infty, ERRNO_UNCHANGED),
65
66    TEST_ff_f (pow, minus_infty, 2, plus_infty, ERRNO_UNCHANGED),
67    TEST_ff_f (pow, minus_infty, 12, plus_infty, ERRNO_UNCHANGED),
68    TEST_ff_f (pow, minus_infty, 1002, plus_infty, ERRNO_UNCHANGED),
69    TEST_ff_f (pow, minus_infty, 0.1L, plus_infty, ERRNO_UNCHANGED),
70    TEST_ff_f (pow, minus_infty, 1.1L, plus_infty, ERRNO_UNCHANGED),
71    TEST_ff_f (pow, minus_infty, 11.1L, plus_infty, ERRNO_UNCHANGED),
72    TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty, ERRNO_UNCHANGED),
73    TEST_ff_f (pow, minus_infty, min_subnorm_value, plus_infty, ERRNO_UNCHANGED),
74
75    TEST_ff_f (pow, minus_infty, -1, minus_zero, ERRNO_UNCHANGED),
76    TEST_ff_f (pow, minus_infty, -11, minus_zero, ERRNO_UNCHANGED),
77    TEST_ff_f (pow, minus_infty, -1001, minus_zero, ERRNO_UNCHANGED),
78
79    TEST_ff_f (pow, minus_infty, -2, 0, ERRNO_UNCHANGED),
80    TEST_ff_f (pow, minus_infty, -12, 0, ERRNO_UNCHANGED),
81    TEST_ff_f (pow, minus_infty, -1002, 0, ERRNO_UNCHANGED),
82    TEST_ff_f (pow, minus_infty, -0.1L, 0, ERRNO_UNCHANGED),
83    TEST_ff_f (pow, minus_infty, -1.1L, 0, ERRNO_UNCHANGED),
84    TEST_ff_f (pow, minus_infty, -11.1L, 0, ERRNO_UNCHANGED),
85    TEST_ff_f (pow, minus_infty, -1001.1L, 0, ERRNO_UNCHANGED),
86    TEST_ff_f (pow, minus_infty, -min_subnorm_value, 0, ERRNO_UNCHANGED),
87
88    TEST_ff_f (pow, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
89    TEST_ff_f (pow, qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
90    TEST_ff_f (pow, -qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
91    TEST_ff_f (pow, -qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
92    TEST_ff_f (pow, qnan_value, snan_value, qnan_value, INVALID_EXCEPTION),
93    TEST_ff_f (pow, qnan_value, -snan_value, qnan_value, INVALID_EXCEPTION),
94    TEST_ff_f (pow, -qnan_value, snan_value, qnan_value, INVALID_EXCEPTION),
95    TEST_ff_f (pow, -qnan_value, -snan_value, qnan_value, INVALID_EXCEPTION),
96    TEST_ff_f (pow, snan_value, qnan_value, qnan_value, INVALID_EXCEPTION),
97    TEST_ff_f (pow, snan_value, -qnan_value, qnan_value, INVALID_EXCEPTION),
98    TEST_ff_f (pow, -snan_value, qnan_value, qnan_value, INVALID_EXCEPTION),
99    TEST_ff_f (pow, -snan_value, -qnan_value, qnan_value, INVALID_EXCEPTION),
100    TEST_ff_f (pow, snan_value, snan_value, qnan_value, INVALID_EXCEPTION),
101    TEST_ff_f (pow, snan_value, -snan_value, qnan_value, INVALID_EXCEPTION),
102    TEST_ff_f (pow, -snan_value, snan_value, qnan_value, INVALID_EXCEPTION),
103    TEST_ff_f (pow, -snan_value, -snan_value, qnan_value, INVALID_EXCEPTION),
104    TEST_ff_f (pow, 0, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
105    TEST_ff_f (pow, 0, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
106    TEST_ff_f (pow, 0, snan_value, qnan_value, INVALID_EXCEPTION),
107    TEST_ff_f (pow, 0, -snan_value, qnan_value, INVALID_EXCEPTION),
108    TEST_ff_f (pow, 1, qnan_value, 1, ERRNO_UNCHANGED),
109    TEST_ff_f (pow, 1, -qnan_value, 1, ERRNO_UNCHANGED),
110    TEST_ff_f (pow, 1, snan_value, qnan_value, INVALID_EXCEPTION|NO_TEST_MATHVEC),
111    TEST_ff_f (pow, 1, -snan_value, qnan_value, INVALID_EXCEPTION|NO_TEST_MATHVEC),
112    TEST_ff_f (pow, -1, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
113    TEST_ff_f (pow, -1, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
114    TEST_ff_f (pow, -1, snan_value, qnan_value, INVALID_EXCEPTION),
115    TEST_ff_f (pow, -1, -snan_value, qnan_value, INVALID_EXCEPTION),
116    TEST_ff_f (pow, qnan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
117    TEST_ff_f (pow, -qnan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
118    TEST_ff_f (pow, snan_value, 1, qnan_value, INVALID_EXCEPTION),
119    TEST_ff_f (pow, -snan_value, 1, qnan_value, INVALID_EXCEPTION),
120    TEST_ff_f (pow, qnan_value, -1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
121    TEST_ff_f (pow, -qnan_value, -1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
122    TEST_ff_f (pow, snan_value, -1, qnan_value, INVALID_EXCEPTION),
123    TEST_ff_f (pow, -snan_value, -1, qnan_value, INVALID_EXCEPTION),
124
125    /* pow (x, qNaN or sNaN) == qNaN.  */
126    TEST_ff_f (pow, 3.0, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
127    TEST_ff_f (pow, 3.0, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
128    TEST_ff_f (pow, minus_zero, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
129    TEST_ff_f (pow, minus_zero, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
130    TEST_ff_f (pow, plus_infty, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
131    TEST_ff_f (pow, plus_infty, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
132    TEST_ff_f (pow, -3.0, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
133    TEST_ff_f (pow, -3.0, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
134    TEST_ff_f (pow, minus_infty, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
135    TEST_ff_f (pow, minus_infty, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
136    TEST_ff_f (pow, 3.0, snan_value, qnan_value, INVALID_EXCEPTION),
137    TEST_ff_f (pow, 3.0, -snan_value, qnan_value, INVALID_EXCEPTION),
138    TEST_ff_f (pow, minus_zero, snan_value, qnan_value, INVALID_EXCEPTION),
139    TEST_ff_f (pow, minus_zero, -snan_value, qnan_value, INVALID_EXCEPTION),
140    TEST_ff_f (pow, plus_infty, snan_value, qnan_value, INVALID_EXCEPTION),
141    TEST_ff_f (pow, plus_infty, -snan_value, qnan_value, INVALID_EXCEPTION),
142    TEST_ff_f (pow, -3.0, snan_value, qnan_value, INVALID_EXCEPTION),
143    TEST_ff_f (pow, -3.0, -snan_value, qnan_value, INVALID_EXCEPTION),
144    TEST_ff_f (pow, minus_infty, snan_value, qnan_value, INVALID_EXCEPTION),
145    TEST_ff_f (pow, minus_infty, -snan_value, qnan_value, INVALID_EXCEPTION),
146
147    TEST_ff_f (pow, qnan_value, 3.0, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
148    TEST_ff_f (pow, -qnan_value, 3.0, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
149    TEST_ff_f (pow, qnan_value, -3.0, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
150    TEST_ff_f (pow, -qnan_value, -3.0, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
151    TEST_ff_f (pow, qnan_value, plus_infty, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
152    TEST_ff_f (pow, -qnan_value, plus_infty, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
153    TEST_ff_f (pow, qnan_value, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
154    TEST_ff_f (pow, -qnan_value, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
155    TEST_ff_f (pow, qnan_value, 2.5, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
156    TEST_ff_f (pow, -qnan_value, 2.5, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
157    TEST_ff_f (pow, qnan_value, -2.5, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
158    TEST_ff_f (pow, -qnan_value, -2.5, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
159    TEST_ff_f (pow, qnan_value, min_subnorm_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
160    TEST_ff_f (pow, -qnan_value, min_subnorm_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
161    TEST_ff_f (pow, qnan_value, -min_subnorm_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
162    TEST_ff_f (pow, -qnan_value, -min_subnorm_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
163    TEST_ff_f (pow, snan_value, 3.0, qnan_value, INVALID_EXCEPTION),
164    TEST_ff_f (pow, -snan_value, 3.0, qnan_value, INVALID_EXCEPTION),
165    TEST_ff_f (pow, snan_value, -3.0, qnan_value, INVALID_EXCEPTION),
166    TEST_ff_f (pow, -snan_value, -3.0, qnan_value, INVALID_EXCEPTION),
167    TEST_ff_f (pow, snan_value, plus_infty, qnan_value, INVALID_EXCEPTION),
168    TEST_ff_f (pow, -snan_value, plus_infty, qnan_value, INVALID_EXCEPTION),
169    TEST_ff_f (pow, snan_value, minus_infty, qnan_value, INVALID_EXCEPTION),
170    TEST_ff_f (pow, -snan_value, minus_infty, qnan_value, INVALID_EXCEPTION),
171    TEST_ff_f (pow, snan_value, 2.5, qnan_value, INVALID_EXCEPTION),
172    TEST_ff_f (pow, -snan_value, 2.5, qnan_value, INVALID_EXCEPTION),
173    TEST_ff_f (pow, snan_value, -2.5, qnan_value, INVALID_EXCEPTION),
174    TEST_ff_f (pow, -snan_value, -2.5, qnan_value, INVALID_EXCEPTION),
175    TEST_ff_f (pow, snan_value, min_subnorm_value, qnan_value, INVALID_EXCEPTION),
176    TEST_ff_f (pow, -snan_value, min_subnorm_value, qnan_value, INVALID_EXCEPTION),
177    TEST_ff_f (pow, snan_value, -min_subnorm_value, qnan_value, INVALID_EXCEPTION),
178    TEST_ff_f (pow, -snan_value, -min_subnorm_value, qnan_value, INVALID_EXCEPTION),
179
180    TEST_ff_f (pow, 1, plus_infty, 1, ERRNO_UNCHANGED),
181    TEST_ff_f (pow, -1, plus_infty, 1, ERRNO_UNCHANGED),
182    TEST_ff_f (pow, 1, minus_infty, 1, ERRNO_UNCHANGED),
183    TEST_ff_f (pow, -1, minus_infty, 1, ERRNO_UNCHANGED),
184
185    /* pow (x, +-0) == 1.  */
186    TEST_ff_f (pow, plus_infty, 0, 1, ERRNO_UNCHANGED),
187    TEST_ff_f (pow, plus_infty, minus_zero, 1, ERRNO_UNCHANGED),
188    TEST_ff_f (pow, minus_infty, 0, 1, ERRNO_UNCHANGED),
189    TEST_ff_f (pow, minus_infty, minus_zero, 1, ERRNO_UNCHANGED),
190
191    TEST_ff_f (pow, -0.1L, 1.1L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
192    TEST_ff_f (pow, -0.1L, -1.1L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
193    TEST_ff_f (pow, -10.1L, 1.1L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
194    TEST_ff_f (pow, -10.1L, -1.1L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
195    TEST_ff_f (pow, -1.01L, min_subnorm_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
196    TEST_ff_f (pow, -1.01L, -min_subnorm_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
197    TEST_ff_f (pow, -1.0L, min_subnorm_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
198    TEST_ff_f (pow, -1.0L, -min_subnorm_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
199
200    TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
201    TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
202    TEST_ff_f (pow, 0, -0xffffff, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
203#if !TEST_COND_binary32
204    TEST_ff_f (pow, 0, -0x1.fffffffffffffp+52L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
205#endif
206#if MANT_DIG >= 64
207    TEST_ff_f (pow, 0, -0x1.fffffffffffffffep+63L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
208# if MANT_DIG >= 106
209    TEST_ff_f (pow, 0, -0x1.ffffffffffffffffffffffffff8p+105L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
210# endif
211# if MANT_DIG >= 113
212    TEST_ff_f (pow, 0, -0x1.ffffffffffffffffffffffffffffp+112L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
213# endif
214#endif
215    TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
216    TEST_ff_f (pow, minus_zero, -11L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
217    TEST_ff_f (pow, minus_zero, -0xffffff, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
218    TEST_ff_f (pow, minus_zero, -0x1fffffe, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
219#if !TEST_COND_binary32
220    TEST_ff_f (pow, minus_zero, -0x1.fffffffffffffp+52L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
221    TEST_ff_f (pow, minus_zero, -0x1.fffffffffffffp+53L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
222#endif
223#if MANT_DIG >= 64
224    TEST_ff_f (pow, minus_zero, -0x1.fffffffffffffffep+63L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
225    TEST_ff_f (pow, minus_zero, -0x1.fffffffffffffffep+64L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE|XFAIL_ROUNDING_IBM128_LIBGCC),
226# if MANT_DIG >= 106
227    TEST_ff_f (pow, minus_zero, -0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
228    TEST_ff_f (pow, minus_zero, -0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE|XFAIL_ROUNDING_IBM128_LIBGCC),
229# endif
230# if MANT_DIG >= 113
231    TEST_ff_f (pow, minus_zero, -0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
232    TEST_ff_f (pow, minus_zero, -0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
233# endif
234#endif
235
236    TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
237    TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
238    TEST_ff_f (pow, 0, -min_subnorm_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
239    TEST_ff_f (pow, 0, -0x1p24, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
240    TEST_ff_f (pow, 0, -0x1p127, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
241    TEST_ff_f (pow, 0, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
242    TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
243    TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
244    TEST_ff_f (pow, minus_zero, -min_subnorm_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
245    TEST_ff_f (pow, minus_zero, -0x1p24, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
246    TEST_ff_f (pow, minus_zero, -0x1p127, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
247    TEST_ff_f (pow, minus_zero, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
248
249    TEST_ff_f (pow, 0, plus_infty, 0, ERRNO_UNCHANGED),
250    TEST_ff_f (pow, minus_zero, plus_infty, 0, ERRNO_UNCHANGED),
251    /* C99 erroneously specified a divide-by-zero exception here,
252       which is not permitted in C2x (C11 specified it as optional).
253       See <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1515.pdf>
254       and
255       <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2271.pdf>.  */
256    TEST_ff_f (pow, 0, minus_infty, plus_infty, ERRNO_UNCHANGED),
257    TEST_ff_f (pow, minus_zero, minus_infty, plus_infty, ERRNO_UNCHANGED),
258
259    /* pow (x, +inf) == +inf for |x| > 1.  */
260    TEST_ff_f (pow, 1.5, plus_infty, plus_infty, ERRNO_UNCHANGED),
261
262    /* pow (x, +inf) == +0 for |x| < 1.  */
263    TEST_ff_f (pow, 0.5, plus_infty, 0.0, ERRNO_UNCHANGED),
264
265    /* pow (x, -inf) == +0 for |x| > 1.  */
266    TEST_ff_f (pow, 1.5, minus_infty, 0.0, ERRNO_UNCHANGED),
267
268    /* pow (x, -inf) == +inf for |x| < 1.  */
269    TEST_ff_f (pow, 0.5, minus_infty, plus_infty, ERRNO_UNCHANGED),
270
271    /* pow (+inf, y) == +inf for y > 0.  */
272    TEST_ff_f (pow, plus_infty, 2, plus_infty, ERRNO_UNCHANGED),
273    TEST_ff_f (pow, plus_infty, 0xffffff, plus_infty, ERRNO_UNCHANGED),
274#if !TEST_COND_binary32
275    TEST_ff_f (pow, plus_infty, 0x1.fffffffffffffp+52L, plus_infty, ERRNO_UNCHANGED),
276#endif
277#if MANT_DIG >= 64
278    TEST_ff_f (pow, plus_infty, 0x1.fffffffffffffffep+63L, plus_infty, ERRNO_UNCHANGED),
279# if MANT_DIG >= 106
280    TEST_ff_f (pow, plus_infty, 0x1.ffffffffffffffffffffffffff8p+105L, plus_infty, ERRNO_UNCHANGED),
281# endif
282# if MANT_DIG >= 113
283    TEST_ff_f (pow, plus_infty, 0x1.ffffffffffffffffffffffffffffp+112L, plus_infty, ERRNO_UNCHANGED),
284# endif
285#endif
286    TEST_ff_f (pow, plus_infty, 0x1p24, plus_infty, ERRNO_UNCHANGED),
287    TEST_ff_f (pow, plus_infty, 0x1p127, plus_infty, ERRNO_UNCHANGED),
288    TEST_ff_f (pow, plus_infty, max_value, plus_infty, ERRNO_UNCHANGED),
289
290    /* pow (+inf, y) == +0 for y < 0.  */
291    TEST_ff_f (pow, plus_infty, -1, 0.0, ERRNO_UNCHANGED),
292    TEST_ff_f (pow, plus_infty, -0xffffff, 0.0, ERRNO_UNCHANGED),
293#if !TEST_COND_binary32
294    TEST_ff_f (pow, plus_infty, -0x1.fffffffffffffp+52L, 0.0, ERRNO_UNCHANGED),
295#endif
296#if MANT_DIG >= 64
297    TEST_ff_f (pow, plus_infty, -0x1.fffffffffffffffep+63L, 0.0, ERRNO_UNCHANGED),
298# if MANT_DIG >= 106
299    TEST_ff_f (pow, plus_infty, -0x1.ffffffffffffffffffffffffff8p+105L, 0.0, ERRNO_UNCHANGED),
300# endif
301# if MANT_DIG >= 113
302    TEST_ff_f (pow, plus_infty, -0x1.ffffffffffffffffffffffffffffp+112L, 0.0, ERRNO_UNCHANGED),
303# endif
304#endif
305    TEST_ff_f (pow, plus_infty, -0x1p24, 0.0, ERRNO_UNCHANGED),
306    TEST_ff_f (pow, plus_infty, -0x1p127, 0.0, ERRNO_UNCHANGED),
307    TEST_ff_f (pow, plus_infty, -max_value, 0.0, ERRNO_UNCHANGED),
308
309    /* pow (-inf, y) == -inf for y an odd integer > 0.  */
310    TEST_ff_f (pow, minus_infty, 27, minus_infty, ERRNO_UNCHANGED),
311    TEST_ff_f (pow, minus_infty, 0xffffff, minus_infty, ERRNO_UNCHANGED),
312    TEST_ff_f (pow, minus_infty, 0x1fffffe, plus_infty, ERRNO_UNCHANGED),
313#if !TEST_COND_binary32
314    TEST_ff_f (pow, minus_infty, 0x1.fffffffffffffp+52L, minus_infty, ERRNO_UNCHANGED),
315    TEST_ff_f (pow, minus_infty, 0x1.fffffffffffffp+53L, plus_infty, ERRNO_UNCHANGED),
316#endif
317#if MANT_DIG >= 64
318    TEST_ff_f (pow, minus_infty, 0x1.fffffffffffffffep+63L, minus_infty, ERRNO_UNCHANGED),
319    TEST_ff_f (pow, minus_infty, 0x1.fffffffffffffffep+64L, plus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC),
320# if MANT_DIG >= 106
321    TEST_ff_f (pow, minus_infty, 0x1.ffffffffffffffffffffffffff8p+105L, minus_infty, ERRNO_UNCHANGED),
322    TEST_ff_f (pow, minus_infty, 0x1.ffffffffffffffffffffffffff8p+106L, plus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC),
323# endif
324# if MANT_DIG >= 113
325    TEST_ff_f (pow, minus_infty, 0x1.ffffffffffffffffffffffffffffp+112L, minus_infty, ERRNO_UNCHANGED),
326    TEST_ff_f (pow, minus_infty, 0x1.ffffffffffffffffffffffffffffp+113L, plus_infty, ERRNO_UNCHANGED),
327# endif
328#endif
329
330    /* pow (-inf, y) == +inf for y > 0 and not an odd integer.  */
331    TEST_ff_f (pow, minus_infty, 0.5, plus_infty, ERRNO_UNCHANGED),
332    TEST_ff_f (pow, minus_infty, 28, plus_infty, ERRNO_UNCHANGED),
333    TEST_ff_f (pow, minus_infty, 0x1p24, plus_infty, ERRNO_UNCHANGED),
334    TEST_ff_f (pow, minus_infty, 0x1p127, plus_infty, ERRNO_UNCHANGED),
335    TEST_ff_f (pow, minus_infty, max_value, plus_infty, ERRNO_UNCHANGED),
336
337    /* pow (-inf, y) == -0 for y an odd integer < 0. */
338    TEST_ff_f (pow, minus_infty, -3, minus_zero, ERRNO_UNCHANGED),
339    TEST_ff_f (pow, minus_infty, -0xffffff, minus_zero, ERRNO_UNCHANGED),
340    TEST_ff_f (pow, minus_infty, -0x1fffffe, plus_zero, ERRNO_UNCHANGED),
341#if !TEST_COND_binary32
342    TEST_ff_f (pow, minus_infty, -0x1.fffffffffffffp+52L, minus_zero, ERRNO_UNCHANGED),
343    TEST_ff_f (pow, minus_infty, -0x1.fffffffffffffp+53L, plus_zero, ERRNO_UNCHANGED),
344#endif
345#if MANT_DIG >= 64
346    TEST_ff_f (pow, minus_infty, -0x1.fffffffffffffffep+63L, minus_zero, ERRNO_UNCHANGED),
347    TEST_ff_f (pow, minus_infty, -0x1.fffffffffffffffep+64L, plus_zero, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC),
348# if MANT_DIG >= 106
349    TEST_ff_f (pow, minus_infty, -0x1.ffffffffffffffffffffffffff8p+105L, minus_zero, ERRNO_UNCHANGED),
350    TEST_ff_f (pow, minus_infty, -0x1.ffffffffffffffffffffffffff8p+106L, plus_zero, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC),
351# endif
352# if MANT_DIG >= 113
353    TEST_ff_f (pow, minus_infty, -0x1.ffffffffffffffffffffffffffffp+112L, minus_zero, ERRNO_UNCHANGED),
354    TEST_ff_f (pow, minus_infty, -0x1.ffffffffffffffffffffffffffffp+113L, plus_zero, ERRNO_UNCHANGED),
355# endif
356#endif
357    /* pow (-inf, y) == +0 for y < 0 and not an odd integer.  */
358    TEST_ff_f (pow, minus_infty, -2.0, 0.0, ERRNO_UNCHANGED),
359    TEST_ff_f (pow, minus_infty, -0x1p24, 0.0, ERRNO_UNCHANGED),
360    TEST_ff_f (pow, minus_infty, -0x1p127, 0.0, ERRNO_UNCHANGED),
361    TEST_ff_f (pow, minus_infty, -max_value, 0.0, ERRNO_UNCHANGED),
362
363    TEST_ff_f (pow, -max_value, 0.5, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
364    TEST_ff_f (pow, -max_value, 1.5, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
365    TEST_ff_f (pow, -max_value, 1000.5, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
366
367    TEST_ff_f (pow, -min_value, 0.5, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
368    TEST_ff_f (pow, -min_value, 1.5, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
369    TEST_ff_f (pow, -min_value, 1000.5, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
370    AUTO_TESTS_ff_f (pow),
371  };
372
373static void
374pow_test (void)
375{
376  ALL_RM_TEST (pow, 0, pow_test_data, RUN_TEST_LOOP_ff_f, END);
377}
378
379static void
380do_test (void)
381{
382  pow_test ();
383}
384
385/*
386 * Local Variables:
387 * mode:c
388 * End:
389 */
390