]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/netbsd-tests/lib/libm/t_pow.c
MFC r305358,r305449,r305451,r306367,r306397,r309474:
[FreeBSD/stable/10.git] / contrib / netbsd-tests / lib / libm / t_pow.c
1 /* $NetBSD: t_pow.c,v 1.4 2015/09/08 05:24:27 dholland Exp $ */
2
3 /*-
4  * Copyright (c) 2011 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Jukka Ruohonen.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 #include <sys/cdefs.h>
32 __RCSID("$NetBSD: t_pow.c,v 1.4 2015/09/08 05:24:27 dholland Exp $");
33
34 #include <atf-c.h>
35 #include <math.h>
36
37 #ifdef __FreeBSD__
38 #define isinff isinf
39 #endif
40
41 /*
42  * pow(3)
43  */
44 ATF_TC(pow_nan_x);
45 ATF_TC_HEAD(pow_nan_x, tc)
46 {
47         atf_tc_set_md_var(tc, "descr", "Test pow(NaN, y) == NaN");
48 }
49
50 ATF_TC_BODY(pow_nan_x, tc)
51 {
52         const double x = 0.0L / 0.0L;
53
54         ATF_CHECK(isnan(pow(x, 2.0)) != 0);
55 }
56
57 ATF_TC(pow_nan_y);
58 ATF_TC_HEAD(pow_nan_y, tc)
59 {
60         atf_tc_set_md_var(tc, "descr", "Test pow(x, NaN) == NaN");
61 }
62
63 ATF_TC_BODY(pow_nan_y, tc)
64 {
65         const double y = 0.0L / 0.0L;
66
67         ATF_CHECK(isnan(pow(2.0, y)) != 0);
68 }
69
70 ATF_TC(pow_inf_neg_x);
71 ATF_TC_HEAD(pow_inf_neg_x, tc)
72 {
73         atf_tc_set_md_var(tc, "descr", "Test pow(-Inf, y) == +-Inf || +-0.0");
74 }
75
76 ATF_TC_BODY(pow_inf_neg_x, tc)
77 {
78         const double x = -1.0L / 0.0L;
79         double z;
80
81         /*
82          * If y is odd, y > 0, and x is -Inf, -Inf is returned.
83          * If y is even, y > 0, and x is -Inf, +Inf is returned.
84          */
85         z = pow(x, 3.0);
86
87         if (isinf(z) == 0 || signbit(z) == 0)
88                 atf_tc_fail_nonfatal("pow(-Inf, 3.0) != -Inf");
89
90         z = pow(x, 4.0);
91
92         if (isinf(z) == 0 || signbit(z) != 0)
93                 atf_tc_fail_nonfatal("pow(-Inf, 4.0) != +Inf");
94
95         /*
96          * If y is odd, y < 0, and x is -Inf, -0.0 is returned.
97          * If y is even, y < 0, and x is -Inf, +0.0 is returned.
98          */
99         z = pow(x, -3.0);
100
101         if (fabs(z) > 0.0 || signbit(z) == 0)
102                 atf_tc_fail_nonfatal("pow(-Inf, -3.0) != -0.0");
103
104         z = pow(x, -4.0);
105
106         if (fabs(z) > 0.0 || signbit(z) != 0)
107                 atf_tc_fail_nonfatal("pow(-Inf -4.0) != +0.0");
108 }
109
110 ATF_TC(pow_inf_neg_y);
111 ATF_TC_HEAD(pow_inf_neg_y, tc)
112 {
113         atf_tc_set_md_var(tc, "descr", "Test pow(x, -Inf) == +Inf || +0.0");
114 }
115
116 ATF_TC_BODY(pow_inf_neg_y, tc)
117 {
118         const double y = -1.0L / 0.0L;
119         double z;
120
121         /*
122          * If |x| < 1 and y is -Inf, +Inf is returned.
123          * If |x| > 1 and y is -Inf, +0.0 is returned.
124          */
125         z = pow(0.1, y);
126
127         if (isinf(z) == 0 || signbit(z) != 0)
128                 atf_tc_fail_nonfatal("pow(0.1, -Inf) != +Inf");
129
130         z = pow(1.1, y);
131
132         if (fabs(z) > 0.0 || signbit(z) != 0)
133                 atf_tc_fail_nonfatal("pow(1.1, -Inf) != +0.0");
134 }
135
136 ATF_TC(pow_inf_pos_x);
137 ATF_TC_HEAD(pow_inf_pos_x, tc)
138 {
139         atf_tc_set_md_var(tc, "descr", "Test pow(+Inf, y) == +Inf || +0.0");
140 }
141
142 ATF_TC_BODY(pow_inf_pos_x, tc)
143 {
144         const double x = 1.0L / 0.0L;
145         double z;
146
147         /*
148          * For y < 0, if x is +Inf, +0.0 is returned.
149          * For y > 0, if x is +Inf, +Inf is returned.
150          */
151         z = pow(x, -2.0);
152
153         if (fabs(z) > 0.0 || signbit(z) != 0)
154                 atf_tc_fail_nonfatal("pow(+Inf, -2.0) != +0.0");
155
156         z = pow(x, 2.0);
157
158         if (isinf(z) == 0 || signbit(z) != 0)
159                 atf_tc_fail_nonfatal("pow(+Inf, 2.0) != +Inf");
160 }
161
162 ATF_TC(pow_inf_pos_y);
163 ATF_TC_HEAD(pow_inf_pos_y, tc)
164 {
165         atf_tc_set_md_var(tc, "descr", "Test pow(x, +Inf) == +Inf || +0.0");
166 }
167
168 ATF_TC_BODY(pow_inf_pos_y, tc)
169 {
170         const double y = 1.0L / 0.0L;
171         double z;
172
173         /*
174          * If |x| < 1 and y is +Inf, +0.0 is returned.
175          * If |x| > 1 and y is +Inf, +Inf is returned.
176          */
177         z = pow(0.1, y);
178
179         if (fabs(z) > 0.0 || signbit(z) != 0)
180                 atf_tc_fail_nonfatal("pow(0.1, +Inf) != +0.0");
181
182         z = pow(1.1, y);
183
184         if (isinf(z) == 0 || signbit(z) != 0)
185                 atf_tc_fail_nonfatal("pow(1.1, +Inf) != +Inf");
186 }
187
188 ATF_TC(pow_one_neg_x);
189 ATF_TC_HEAD(pow_one_neg_x, tc)
190 {
191         atf_tc_set_md_var(tc, "descr", "Test pow(-1.0, +-Inf) == 1.0");
192 }
193
194 ATF_TC_BODY(pow_one_neg_x, tc)
195 {
196         const double infp = 1.0L / 0.0L;
197         const double infn = -1.0L / 0.0L;
198
199         /*
200          * If x is -1.0, and y is +-Inf, 1.0 shall be returned.
201          */
202         ATF_REQUIRE(isinf(infp) != 0);
203         ATF_REQUIRE(isinf(infn) != 0);
204
205         if (pow(-1.0, infp) != 1.0) {
206                 atf_tc_expect_fail("PR lib/45372");
207                 atf_tc_fail_nonfatal("pow(-1.0, +Inf) != 1.0");
208         }
209
210         if (pow(-1.0, infn) != 1.0) {
211                 atf_tc_expect_fail("PR lib/45372");
212                 atf_tc_fail_nonfatal("pow(-1.0, -Inf) != 1.0");
213         }
214 }
215
216 ATF_TC(pow_one_pos_x);
217 ATF_TC_HEAD(pow_one_pos_x, tc)
218 {
219         atf_tc_set_md_var(tc, "descr", "Test pow(1.0, y) == 1.0");
220 }
221
222 ATF_TC_BODY(pow_one_pos_x, tc)
223 {
224         const double y[] = { 0.0, 0.1, 2.0, -3.0, 99.0, 99.99, 9999999.9 };
225         const double z = 0.0L / 0.0L;
226         size_t i;
227
228         /*
229          * For any value of y (including NaN),
230          * if x is 1.0, 1.0 shall be returned.
231          */
232         if (pow(1.0, z) != 1.0)
233                 atf_tc_fail_nonfatal("pow(1.0, NaN) != 1.0");
234
235         for (i = 0; i < __arraycount(y); i++) {
236
237                 if (pow(1.0, y[i]) != 1.0)
238                         atf_tc_fail_nonfatal("pow(1.0, %0.01f) != 1.0", y[i]);
239         }
240 }
241
242 ATF_TC(pow_zero_x);
243 ATF_TC_HEAD(pow_zero_x, tc)
244 {
245         atf_tc_set_md_var(tc, "descr", "Test pow(+-0.0, y) == +-0.0 || HUGE");
246 }
247
248 ATF_TC_BODY(pow_zero_x, tc)
249 {
250         double z;
251
252         /*
253          * If x is +0.0 or -0.0, y > 0, and y
254          * is an odd integer, x is returned.
255          */
256         z = pow(+0.0, 3.0);
257
258         if (fabs(z) > 0.0 || signbit(z) != 0)
259                 atf_tc_fail_nonfatal("pow(+0.0, 3.0) != +0.0");
260
261         z = pow(-0.0, 3.0);
262
263         if (fabs(z) > 0.0 || signbit(z) == 0)
264                 atf_tc_fail_nonfatal("pow(-0.0, 3.0) != -0.0");
265
266         /*
267          * If y > 0 and not an odd integer,
268          * if x is +0.0 or -0.0, +0.0 is returned.
269          */
270         z = pow(+0.0, 4.0);
271
272         if (fabs(z) > 0.0 || signbit(z) != 0)
273                 atf_tc_fail_nonfatal("pow(+0.0, 4.0) != +0.0");
274
275         z = pow(-0.0, 4.0);
276
277         if (fabs(z) > 0.0 || signbit(z) != 0)
278                 atf_tc_fail_nonfatal("pow(-0.0, 4.0) != +0.0");
279
280         /*
281          * If y < 0 and x is +0.0 or -0.0, either +-HUGE_VAL,
282          * +-HUGE_VALF, or +-HUGE_VALL shall be returned.
283          */
284         z = pow(+0.0, -4.0);
285
286         if (z != HUGE_VAL) {
287                 atf_tc_fail_nonfatal("pow(+0.0, -4.0) != HUGE_VAL");
288         }
289
290         z = pow(-0.0, -4.0);
291
292         if (z != HUGE_VAL) {
293                 atf_tc_fail_nonfatal("pow(-0.0, -4.0) != HUGE_VAL");
294         }
295
296         z = pow(+0.0, -5.0);
297
298         if (z != HUGE_VAL) {
299                 atf_tc_fail_nonfatal("pow(+0.0, -5.0) != HUGE_VAL");
300         }
301
302         z = pow(-0.0, -5.0);
303
304         if (z != -HUGE_VAL)
305                 atf_tc_fail_nonfatal("pow(-0.0, -5.0) != -HUGE_VAL");
306 }
307
308 ATF_TC(pow_zero_y);
309 ATF_TC_HEAD(pow_zero_y, tc)
310 {
311         atf_tc_set_md_var(tc, "descr", "Test pow(x, +-0.0) == 1.0");
312 }
313
314 ATF_TC_BODY(pow_zero_y, tc)
315 {
316         const double x[] =  { 0.1, -3.0, 77.0, 99.99, 101.0000001 };
317         const double z = 0.0L / 0.0L;
318         size_t i;
319
320         /*
321          * For any value of x (including NaN),
322          * if y is +0.0 or -0.0, 1.0 is returned.
323          */
324         if (pow(z, +0.0) != 1.0)
325                 atf_tc_fail_nonfatal("pow(NaN, +0.0) != 1.0");
326
327         if (pow(z, -0.0) != 1.0)
328                 atf_tc_fail_nonfatal("pow(NaN, -0.0) != 1.0");
329
330         for (i = 0; i < __arraycount(x); i++) {
331
332                 if (pow(x[i], +0.0) != 1.0)
333                         atf_tc_fail_nonfatal("pow(%0.01f, +0.0) != 1.0", x[i]);
334
335                 if (pow(x[i], -0.0) != 1.0)
336                         atf_tc_fail_nonfatal("pow(%0.01f, -0.0) != 1.0", x[i]);
337         }
338 }
339
340 /*
341  * powf(3)
342  */
343 ATF_TC(powf_nan_x);
344 ATF_TC_HEAD(powf_nan_x, tc)
345 {
346         atf_tc_set_md_var(tc, "descr", "Test powf(NaN, y) == NaN");
347 }
348
349 ATF_TC_BODY(powf_nan_x, tc)
350 {
351         const float x = 0.0L / 0.0L;
352
353         ATF_CHECK(isnanf(powf(x, 2.0)) != 0);
354 }
355
356 ATF_TC(powf_nan_y);
357 ATF_TC_HEAD(powf_nan_y, tc)
358 {
359         atf_tc_set_md_var(tc, "descr", "Test powf(x, NaN) == NaN");
360 }
361
362 ATF_TC_BODY(powf_nan_y, tc)
363 {
364         const float y = 0.0L / 0.0L;
365
366         ATF_CHECK(isnanf(powf(2.0, y)) != 0);
367 }
368
369 ATF_TC(powf_inf_neg_x);
370 ATF_TC_HEAD(powf_inf_neg_x, tc)
371 {
372         atf_tc_set_md_var(tc, "descr", "Test powf(-Inf, y) == +-Inf || +-0.0");
373 }
374
375 ATF_TC_BODY(powf_inf_neg_x, tc)
376 {
377         const float x = -1.0L / 0.0L;
378         float z;
379
380         /*
381          * If y is odd, y > 0, and x is -Inf, -Inf is returned.
382          * If y is even, y > 0, and x is -Inf, +Inf is returned.
383          */
384         z = powf(x, 3.0);
385
386         if (isinff(z) == 0 || signbit(z) == 0)
387                 atf_tc_fail_nonfatal("powf(-Inf, 3.0) != -Inf");
388
389         z = powf(x, 4.0);
390
391         if (isinff(z) == 0 || signbit(z) != 0)
392                 atf_tc_fail_nonfatal("powf(-Inf, 4.0) != +Inf");
393
394         /*
395          * If y is odd, y < 0, and x is -Inf, -0.0 is returned.
396          * If y is even, y < 0, and x is -Inf, +0.0 is returned.
397          */
398         z = powf(x, -3.0);
399
400         if (fabsf(z) > 0.0 || signbit(z) == 0) {
401                 atf_tc_expect_fail("PR lib/45372");
402                 atf_tc_fail_nonfatal("powf(-Inf, -3.0) != -0.0");
403         }
404
405         z = powf(x, -4.0);
406
407         if (fabsf(z) > 0.0 || signbit(z) != 0)
408                 atf_tc_fail_nonfatal("powf(-Inf -4.0) != +0.0");
409 }
410
411 ATF_TC(powf_inf_neg_y);
412 ATF_TC_HEAD(powf_inf_neg_y, tc)
413 {
414         atf_tc_set_md_var(tc, "descr", "Test powf(x, -Inf) == +Inf || +0.0");
415 }
416
417 ATF_TC_BODY(powf_inf_neg_y, tc)
418 {
419         const float y = -1.0L / 0.0L;
420         float z;
421
422         /*
423          * If |x| < 1 and y is -Inf, +Inf is returned.
424          * If |x| > 1 and y is -Inf, +0.0 is returned.
425          */
426         z = powf(0.1, y);
427
428         if (isinff(z) == 0 || signbit(z) != 0)
429                 atf_tc_fail_nonfatal("powf(0.1, -Inf) != +Inf");
430
431         z = powf(1.1, y);
432
433         if (fabsf(z) > 0.0 || signbit(z) != 0)
434                 atf_tc_fail_nonfatal("powf(1.1, -Inf) != +0.0");
435 }
436
437 ATF_TC(powf_inf_pos_x);
438 ATF_TC_HEAD(powf_inf_pos_x, tc)
439 {
440         atf_tc_set_md_var(tc, "descr", "Test powf(+Inf, y) == +Inf || +0.0");
441 }
442
443 ATF_TC_BODY(powf_inf_pos_x, tc)
444 {
445         const float x = 1.0L / 0.0L;
446         float z;
447
448         /*
449          * For y < 0, if x is +Inf, +0.0 is returned.
450          * For y > 0, if x is +Inf, +Inf is returned.
451          */
452         z = powf(x, -2.0);
453
454         if (fabsf(z) > 0.0 || signbit(z) != 0)
455                 atf_tc_fail_nonfatal("powf(+Inf, -2.0) != +0.0");
456
457         z = powf(x, 2.0);
458
459         if (isinff(z) == 0 || signbit(z) != 0)
460                 atf_tc_fail_nonfatal("powf(+Inf, 2.0) != +Inf");
461 }
462
463 ATF_TC(powf_inf_pos_y);
464 ATF_TC_HEAD(powf_inf_pos_y, tc)
465 {
466         atf_tc_set_md_var(tc, "descr", "Test powf(x, +Inf) == +Inf || +0.0");
467 }
468
469 ATF_TC_BODY(powf_inf_pos_y, tc)
470 {
471         const float y = 1.0L / 0.0L;
472         float z;
473
474         /*
475          * If |x| < 1 and y is +Inf, +0.0 is returned.
476          * If |x| > 1 and y is +Inf, +Inf is returned.
477          */
478         z = powf(0.1, y);
479
480         if (fabsf(z) > 0.0 || signbit(z) != 0)
481                 atf_tc_fail_nonfatal("powf(0.1, +Inf) != +0.0");
482
483         z = powf(1.1, y);
484
485         if (isinff(z) == 0 || signbit(z) != 0)
486                 atf_tc_fail_nonfatal("powf(1.1, +Inf) != +Inf");
487 }
488
489 ATF_TC(powf_one_neg_x);
490 ATF_TC_HEAD(powf_one_neg_x, tc)
491 {
492         atf_tc_set_md_var(tc, "descr", "Test powf(-1.0, +-Inf) == 1.0");
493 }
494
495 ATF_TC_BODY(powf_one_neg_x, tc)
496 {
497         const float infp = 1.0L / 0.0L;
498         const float infn = -1.0L / 0.0L;
499
500         /*
501          * If x is -1.0, and y is +-Inf, 1.0 shall be returned.
502          */
503         ATF_REQUIRE(isinff(infp) != 0);
504         ATF_REQUIRE(isinff(infn) != 0);
505
506         if (powf(-1.0, infp) != 1.0) {
507                 atf_tc_expect_fail("PR lib/45372");
508                 atf_tc_fail_nonfatal("powf(-1.0, +Inf) != 1.0");
509         }
510
511         if (powf(-1.0, infn) != 1.0) {
512                 atf_tc_expect_fail("PR lib/45372");
513                 atf_tc_fail_nonfatal("powf(-1.0, -Inf) != 1.0");
514         }
515 }
516
517 ATF_TC(powf_one_pos_x);
518 ATF_TC_HEAD(powf_one_pos_x, tc)
519 {
520         atf_tc_set_md_var(tc, "descr", "Test powf(1.0, y) == 1.0");
521 }
522
523 ATF_TC_BODY(powf_one_pos_x, tc)
524 {
525         const float y[] = { 0.0, 0.1, 2.0, -3.0, 99.0, 99.99, 9999999.9 };
526         const float z = 0.0L / 0.0L;
527         size_t i;
528
529         /*
530          * For any value of y (including NaN),
531          * if x is 1.0, 1.0 shall be returned.
532          */
533         if (powf(1.0, z) != 1.0)
534                 atf_tc_fail_nonfatal("powf(1.0, NaN) != 1.0");
535
536         for (i = 0; i < __arraycount(y); i++) {
537
538                 if (powf(1.0, y[i]) != 1.0)
539                         atf_tc_fail_nonfatal("powf(1.0, %0.01f) != 1.0", y[i]);
540         }
541 }
542
543 ATF_TC(powf_zero_x);
544 ATF_TC_HEAD(powf_zero_x, tc)
545 {
546         atf_tc_set_md_var(tc, "descr", "Test powf(+-0.0, y) == +-0.0 || HUGE");
547 }
548
549 ATF_TC_BODY(powf_zero_x, tc)
550 {
551         float z;
552
553         /*
554          * If x is +0.0 or -0.0, y > 0, and y
555          * is an odd integer, x is returned.
556          */
557         z = powf(+0.0, 3.0);
558
559         if (fabsf(z) > 0.0 || signbit(z) != 0)
560                 atf_tc_fail_nonfatal("powf(+0.0, 3.0) != +0.0");
561
562         z = powf(-0.0, 3.0);
563
564         if (fabsf(z) > 0.0 || signbit(z) == 0)
565                 atf_tc_fail_nonfatal("powf(-0.0, 3.0) != -0.0");
566
567         /*
568          * If y > 0 and not an odd integer,
569          * if x is +0.0 or -0.0, +0.0 is returned.
570          */
571         z = powf(+0.0, 4.0);
572
573         if (fabsf(z) > 0.0 || signbit(z) != 0)
574                 atf_tc_fail_nonfatal("powf(+0.0, 4.0) != +0.0");
575
576         z = powf(-0.0, 4.0);
577
578         if (fabsf(z) > 0.0 || signbit(z) != 0)
579                 atf_tc_fail_nonfatal("powf(-0.0, 4.0) != +0.0");
580
581         /*
582          * If y < 0 and x is +0.0 or -0.0, either +-HUGE_VAL,
583          * +-HUGE_VALF, or +-HUGE_VALL shall be returned.
584          */
585         z = powf(+0.0, -4.0);
586
587         if (z != HUGE_VALF) {
588                 atf_tc_expect_fail("PR port-amd64/45391");
589                 atf_tc_fail_nonfatal("powf(+0.0, -4.0) != HUGE_VALF");
590         }
591
592         z = powf(-0.0, -4.0);
593
594         if (z != HUGE_VALF) {
595                 atf_tc_expect_fail("PR port-amd64/45391");
596                 atf_tc_fail_nonfatal("powf(-0.0, -4.0) != HUGE_VALF");
597         }
598
599         z = powf(+0.0, -5.0);
600
601         if (z != HUGE_VALF) {
602                 atf_tc_expect_fail("PR port-amd64/45391");
603                 atf_tc_fail_nonfatal("powf(+0.0, -5.0) != HUGE_VALF");
604         }
605
606         z = powf(-0.0, -5.0);
607
608         if (z != -HUGE_VALF)
609                 atf_tc_fail_nonfatal("powf(-0.0, -5.0) != -HUGE_VALF");
610 }
611
612 ATF_TC(powf_zero_y);
613 ATF_TC_HEAD(powf_zero_y, tc)
614 {
615         atf_tc_set_md_var(tc, "descr", "Test powf(x, +-0.0) == 1.0");
616 }
617
618 ATF_TC_BODY(powf_zero_y, tc)
619 {
620         const float x[] =  { 0.1, -3.0, 77.0, 99.99, 101.0000001 };
621         const float z = 0.0L / 0.0L;
622         size_t i;
623
624         /*
625          * For any value of x (including NaN),
626          * if y is +0.0 or -0.0, 1.0 is returned.
627          */
628         if (powf(z, +0.0) != 1.0)
629                 atf_tc_fail_nonfatal("powf(NaN, +0.0) != 1.0");
630
631         if (powf(z, -0.0) != 1.0)
632                 atf_tc_fail_nonfatal("powf(NaN, -0.0) != 1.0");
633
634         for (i = 0; i < __arraycount(x); i++) {
635
636                 if (powf(x[i], +0.0) != 1.0)
637                         atf_tc_fail_nonfatal("powf(%0.01f, +0.0) != 1.0",x[i]);
638
639                 if (powf(x[i], -0.0) != 1.0)
640                         atf_tc_fail_nonfatal("powf(%0.01f, -0.0) != 1.0",x[i]);
641         }
642 }
643
644 ATF_TP_ADD_TCS(tp)
645 {
646
647         ATF_TP_ADD_TC(tp, pow_nan_x);
648         ATF_TP_ADD_TC(tp, pow_nan_y);
649         ATF_TP_ADD_TC(tp, pow_inf_neg_x);
650         ATF_TP_ADD_TC(tp, pow_inf_neg_y);
651         ATF_TP_ADD_TC(tp, pow_inf_pos_x);
652         ATF_TP_ADD_TC(tp, pow_inf_pos_y);
653         ATF_TP_ADD_TC(tp, pow_one_neg_x);
654         ATF_TP_ADD_TC(tp, pow_one_pos_x);
655         ATF_TP_ADD_TC(tp, pow_zero_x);
656         ATF_TP_ADD_TC(tp, pow_zero_y);
657
658         ATF_TP_ADD_TC(tp, powf_nan_x);
659         ATF_TP_ADD_TC(tp, powf_nan_y);
660         ATF_TP_ADD_TC(tp, powf_inf_neg_x);
661         ATF_TP_ADD_TC(tp, powf_inf_neg_y);
662         ATF_TP_ADD_TC(tp, powf_inf_pos_x);
663         ATF_TP_ADD_TC(tp, powf_inf_pos_y);
664         ATF_TP_ADD_TC(tp, powf_one_neg_x);
665         ATF_TP_ADD_TC(tp, powf_one_pos_x);
666         ATF_TP_ADD_TC(tp, powf_zero_x);
667         ATF_TP_ADD_TC(tp, powf_zero_y);
668
669         return atf_no_error();
670 }