1 /* $NetBSD: t_pow.c,v 1.3 2014/03/03 10:39:08 martin 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.3 2014/03/03 10:39:08 martin 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_expect_fail("PR port-amd64/45391"); 288 atf_tc_fail_nonfatal("pow(+0.0, -4.0) != HUGE_VAL"); 289 } 290 291 z = pow(-0.0, -4.0); 292 293 if (z != HUGE_VAL) { 294 atf_tc_expect_fail("PR port-amd64/45391"); 295 atf_tc_fail_nonfatal("pow(-0.0, -4.0) != HUGE_VAL"); 296 } 297 298 z = pow(+0.0, -5.0); 299 300 if (z != HUGE_VAL) { 301 atf_tc_expect_fail("PR port-amd64/45391"); 302 atf_tc_fail_nonfatal("pow(+0.0, -5.0) != HUGE_VAL"); 303 } 304 305 z = pow(-0.0, -5.0); 306 307 if (z != -HUGE_VAL) 308 atf_tc_fail_nonfatal("pow(-0.0, -5.0) != -HUGE_VAL"); 309 } 310 311 ATF_TC(pow_zero_y); 312 ATF_TC_HEAD(pow_zero_y, tc) 313 { 314 atf_tc_set_md_var(tc, "descr", "Test pow(x, +-0.0) == 1.0"); 315 } 316 317 ATF_TC_BODY(pow_zero_y, tc) 318 { 319 const double x[] = { 0.1, -3.0, 77.0, 99.99, 101.0000001 }; 320 const double z = 0.0L / 0.0L; 321 size_t i; 322 323 /* 324 * For any value of x (including NaN), 325 * if y is +0.0 or -0.0, 1.0 is returned. 326 */ 327 if (pow(z, +0.0) != 1.0) 328 atf_tc_fail_nonfatal("pow(NaN, +0.0) != 1.0"); 329 330 if (pow(z, -0.0) != 1.0) 331 atf_tc_fail_nonfatal("pow(NaN, -0.0) != 1.0"); 332 333 for (i = 0; i < __arraycount(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 if (pow(x[i], -0.0) != 1.0) 339 atf_tc_fail_nonfatal("pow(%0.01f, -0.0) != 1.0", x[i]); 340 } 341 } 342 343 /* 344 * powf(3) 345 */ 346 ATF_TC(powf_nan_x); 347 ATF_TC_HEAD(powf_nan_x, tc) 348 { 349 atf_tc_set_md_var(tc, "descr", "Test powf(NaN, y) == NaN"); 350 } 351 352 ATF_TC_BODY(powf_nan_x, tc) 353 { 354 const float x = 0.0L / 0.0L; 355 356 ATF_CHECK(isnanf(powf(x, 2.0)) != 0); 357 } 358 359 ATF_TC(powf_nan_y); 360 ATF_TC_HEAD(powf_nan_y, tc) 361 { 362 atf_tc_set_md_var(tc, "descr", "Test powf(x, NaN) == NaN"); 363 } 364 365 ATF_TC_BODY(powf_nan_y, tc) 366 { 367 const float y = 0.0L / 0.0L; 368 369 ATF_CHECK(isnanf(powf(2.0, y)) != 0); 370 } 371 372 ATF_TC(powf_inf_neg_x); 373 ATF_TC_HEAD(powf_inf_neg_x, tc) 374 { 375 atf_tc_set_md_var(tc, "descr", "Test powf(-Inf, y) == +-Inf || +-0.0"); 376 } 377 378 ATF_TC_BODY(powf_inf_neg_x, tc) 379 { 380 const float x = -1.0L / 0.0L; 381 float z; 382 383 /* 384 * If y is odd, y > 0, and x is -Inf, -Inf is returned. 385 * If y is even, y > 0, and x is -Inf, +Inf is returned. 386 */ 387 z = powf(x, 3.0); 388 389 if (isinff(z) == 0 || signbit(z) == 0) 390 atf_tc_fail_nonfatal("powf(-Inf, 3.0) != -Inf"); 391 392 z = powf(x, 4.0); 393 394 if (isinff(z) == 0 || signbit(z) != 0) 395 atf_tc_fail_nonfatal("powf(-Inf, 4.0) != +Inf"); 396 397 /* 398 * If y is odd, y < 0, and x is -Inf, -0.0 is returned. 399 * If y is even, y < 0, and x is -Inf, +0.0 is returned. 400 */ 401 z = powf(x, -3.0); 402 403 if (fabsf(z) > 0.0 || signbit(z) == 0) { 404 atf_tc_expect_fail("PR lib/45372"); 405 atf_tc_fail_nonfatal("powf(-Inf, -3.0) != -0.0"); 406 } 407 408 z = powf(x, -4.0); 409 410 if (fabsf(z) > 0.0 || signbit(z) != 0) 411 atf_tc_fail_nonfatal("powf(-Inf -4.0) != +0.0"); 412 } 413 414 ATF_TC(powf_inf_neg_y); 415 ATF_TC_HEAD(powf_inf_neg_y, tc) 416 { 417 atf_tc_set_md_var(tc, "descr", "Test powf(x, -Inf) == +Inf || +0.0"); 418 } 419 420 ATF_TC_BODY(powf_inf_neg_y, tc) 421 { 422 const float y = -1.0L / 0.0L; 423 float z; 424 425 /* 426 * If |x| < 1 and y is -Inf, +Inf is returned. 427 * If |x| > 1 and y is -Inf, +0.0 is returned. 428 */ 429 z = powf(0.1, y); 430 431 if (isinff(z) == 0 || signbit(z) != 0) 432 atf_tc_fail_nonfatal("powf(0.1, -Inf) != +Inf"); 433 434 z = powf(1.1, y); 435 436 if (fabsf(z) > 0.0 || signbit(z) != 0) 437 atf_tc_fail_nonfatal("powf(1.1, -Inf) != +0.0"); 438 } 439 440 ATF_TC(powf_inf_pos_x); 441 ATF_TC_HEAD(powf_inf_pos_x, tc) 442 { 443 atf_tc_set_md_var(tc, "descr", "Test powf(+Inf, y) == +Inf || +0.0"); 444 } 445 446 ATF_TC_BODY(powf_inf_pos_x, tc) 447 { 448 const float x = 1.0L / 0.0L; 449 float z; 450 451 /* 452 * For y < 0, if x is +Inf, +0.0 is returned. 453 * For y > 0, if x is +Inf, +Inf is returned. 454 */ 455 z = powf(x, -2.0); 456 457 if (fabsf(z) > 0.0 || signbit(z) != 0) 458 atf_tc_fail_nonfatal("powf(+Inf, -2.0) != +0.0"); 459 460 z = powf(x, 2.0); 461 462 if (isinff(z) == 0 || signbit(z) != 0) 463 atf_tc_fail_nonfatal("powf(+Inf, 2.0) != +Inf"); 464 } 465 466 ATF_TC(powf_inf_pos_y); 467 ATF_TC_HEAD(powf_inf_pos_y, tc) 468 { 469 atf_tc_set_md_var(tc, "descr", "Test powf(x, +Inf) == +Inf || +0.0"); 470 } 471 472 ATF_TC_BODY(powf_inf_pos_y, tc) 473 { 474 const float y = 1.0L / 0.0L; 475 float z; 476 477 /* 478 * If |x| < 1 and y is +Inf, +0.0 is returned. 479 * If |x| > 1 and y is +Inf, +Inf is returned. 480 */ 481 z = powf(0.1, y); 482 483 if (fabsf(z) > 0.0 || signbit(z) != 0) 484 atf_tc_fail_nonfatal("powf(0.1, +Inf) != +0.0"); 485 486 z = powf(1.1, y); 487 488 if (isinff(z) == 0 || signbit(z) != 0) 489 atf_tc_fail_nonfatal("powf(1.1, +Inf) != +Inf"); 490 } 491 492 ATF_TC(powf_one_neg_x); 493 ATF_TC_HEAD(powf_one_neg_x, tc) 494 { 495 atf_tc_set_md_var(tc, "descr", "Test powf(-1.0, +-Inf) == 1.0"); 496 } 497 498 ATF_TC_BODY(powf_one_neg_x, tc) 499 { 500 const float infp = 1.0L / 0.0L; 501 const float infn = -1.0L / 0.0L; 502 503 /* 504 * If x is -1.0, and y is +-Inf, 1.0 shall be returned. 505 */ 506 ATF_REQUIRE(isinff(infp) != 0); 507 ATF_REQUIRE(isinff(infn) != 0); 508 509 if (powf(-1.0, infp) != 1.0) { 510 atf_tc_expect_fail("PR lib/45372"); 511 atf_tc_fail_nonfatal("powf(-1.0, +Inf) != 1.0"); 512 } 513 514 if (powf(-1.0, infn) != 1.0) { 515 atf_tc_expect_fail("PR lib/45372"); 516 atf_tc_fail_nonfatal("powf(-1.0, -Inf) != 1.0"); 517 } 518 } 519 520 ATF_TC(powf_one_pos_x); 521 ATF_TC_HEAD(powf_one_pos_x, tc) 522 { 523 atf_tc_set_md_var(tc, "descr", "Test powf(1.0, y) == 1.0"); 524 } 525 526 ATF_TC_BODY(powf_one_pos_x, tc) 527 { 528 const float y[] = { 0.0, 0.1, 2.0, -3.0, 99.0, 99.99, 9999999.9 }; 529 const float z = 0.0L / 0.0L; 530 size_t i; 531 532 /* 533 * For any value of y (including NaN), 534 * if x is 1.0, 1.0 shall be returned. 535 */ 536 if (powf(1.0, z) != 1.0) 537 atf_tc_fail_nonfatal("powf(1.0, NaN) != 1.0"); 538 539 for (i = 0; i < __arraycount(y); i++) { 540 541 if (powf(1.0, y[i]) != 1.0) 542 atf_tc_fail_nonfatal("powf(1.0, %0.01f) != 1.0", y[i]); 543 } 544 } 545 546 ATF_TC(powf_zero_x); 547 ATF_TC_HEAD(powf_zero_x, tc) 548 { 549 atf_tc_set_md_var(tc, "descr", "Test powf(+-0.0, y) == +-0.0 || HUGE"); 550 } 551 552 ATF_TC_BODY(powf_zero_x, tc) 553 { 554 float z; 555 556 /* 557 * If x is +0.0 or -0.0, y > 0, and y 558 * is an odd integer, x is returned. 559 */ 560 z = powf(+0.0, 3.0); 561 562 if (fabsf(z) > 0.0 || signbit(z) != 0) 563 atf_tc_fail_nonfatal("powf(+0.0, 3.0) != +0.0"); 564 565 z = powf(-0.0, 3.0); 566 567 if (fabsf(z) > 0.0 || signbit(z) == 0) 568 atf_tc_fail_nonfatal("powf(-0.0, 3.0) != -0.0"); 569 570 /* 571 * If y > 0 and not an odd integer, 572 * if x is +0.0 or -0.0, +0.0 is returned. 573 */ 574 z = powf(+0.0, 4.0); 575 576 if (fabsf(z) > 0.0 || signbit(z) != 0) 577 atf_tc_fail_nonfatal("powf(+0.0, 4.0) != +0.0"); 578 579 z = powf(-0.0, 4.0); 580 581 if (fabsf(z) > 0.0 || signbit(z) != 0) 582 atf_tc_fail_nonfatal("powf(-0.0, 4.0) != +0.0"); 583 584 /* 585 * If y < 0 and x is +0.0 or -0.0, either +-HUGE_VAL, 586 * +-HUGE_VALF, or +-HUGE_VALL shall be returned. 587 */ 588 z = powf(+0.0, -4.0); 589 590 if (z != HUGE_VALF) { 591 atf_tc_expect_fail("PR port-amd64/45391"); 592 atf_tc_fail_nonfatal("powf(+0.0, -4.0) != HUGE_VALF"); 593 } 594 595 z = powf(-0.0, -4.0); 596 597 if (z != HUGE_VALF) { 598 atf_tc_expect_fail("PR port-amd64/45391"); 599 atf_tc_fail_nonfatal("powf(-0.0, -4.0) != HUGE_VALF"); 600 } 601 602 z = powf(+0.0, -5.0); 603 604 if (z != HUGE_VALF) { 605 atf_tc_expect_fail("PR port-amd64/45391"); 606 atf_tc_fail_nonfatal("powf(+0.0, -5.0) != HUGE_VALF"); 607 } 608 609 z = powf(-0.0, -5.0); 610 611 if (z != -HUGE_VALF) 612 atf_tc_fail_nonfatal("powf(-0.0, -5.0) != -HUGE_VALF"); 613 } 614 615 ATF_TC(powf_zero_y); 616 ATF_TC_HEAD(powf_zero_y, tc) 617 { 618 atf_tc_set_md_var(tc, "descr", "Test powf(x, +-0.0) == 1.0"); 619 } 620 621 ATF_TC_BODY(powf_zero_y, tc) 622 { 623 const float x[] = { 0.1, -3.0, 77.0, 99.99, 101.0000001 }; 624 const float z = 0.0L / 0.0L; 625 size_t i; 626 627 /* 628 * For any value of x (including NaN), 629 * if y is +0.0 or -0.0, 1.0 is returned. 630 */ 631 if (powf(z, +0.0) != 1.0) 632 atf_tc_fail_nonfatal("powf(NaN, +0.0) != 1.0"); 633 634 if (powf(z, -0.0) != 1.0) 635 atf_tc_fail_nonfatal("powf(NaN, -0.0) != 1.0"); 636 637 for (i = 0; i < __arraycount(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 if (powf(x[i], -0.0) != 1.0) 643 atf_tc_fail_nonfatal("powf(%0.01f, -0.0) != 1.0",x[i]); 644 } 645 } 646 647 ATF_TP_ADD_TCS(tp) 648 { 649 650 ATF_TP_ADD_TC(tp, pow_nan_x); 651 ATF_TP_ADD_TC(tp, pow_nan_y); 652 ATF_TP_ADD_TC(tp, pow_inf_neg_x); 653 ATF_TP_ADD_TC(tp, pow_inf_neg_y); 654 ATF_TP_ADD_TC(tp, pow_inf_pos_x); 655 ATF_TP_ADD_TC(tp, pow_inf_pos_y); 656 ATF_TP_ADD_TC(tp, pow_one_neg_x); 657 ATF_TP_ADD_TC(tp, pow_one_pos_x); 658 ATF_TP_ADD_TC(tp, pow_zero_x); 659 ATF_TP_ADD_TC(tp, pow_zero_y); 660 661 ATF_TP_ADD_TC(tp, powf_nan_x); 662 ATF_TP_ADD_TC(tp, powf_nan_y); 663 ATF_TP_ADD_TC(tp, powf_inf_neg_x); 664 ATF_TP_ADD_TC(tp, powf_inf_neg_y); 665 ATF_TP_ADD_TC(tp, powf_inf_pos_x); 666 ATF_TP_ADD_TC(tp, powf_inf_pos_y); 667 ATF_TP_ADD_TC(tp, powf_one_neg_x); 668 ATF_TP_ADD_TC(tp, powf_one_pos_x); 669 ATF_TP_ADD_TC(tp, powf_zero_x); 670 ATF_TP_ADD_TC(tp, powf_zero_y); 671 672 return atf_no_error(); 673 } 674