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 /* 38 * pow(3) 39 */ 40 ATF_TC(pow_nan_x); 41 ATF_TC_HEAD(pow_nan_x, tc) 42 { 43 atf_tc_set_md_var(tc, "descr", "Test pow(NaN, y) == NaN"); 44 } 45 46 ATF_TC_BODY(pow_nan_x, tc) 47 { 48 const double x = 0.0L / 0.0L; 49 50 ATF_CHECK(isnan(pow(x, 2.0)) != 0); 51 } 52 53 ATF_TC(pow_nan_y); 54 ATF_TC_HEAD(pow_nan_y, tc) 55 { 56 atf_tc_set_md_var(tc, "descr", "Test pow(x, NaN) == NaN"); 57 } 58 59 ATF_TC_BODY(pow_nan_y, tc) 60 { 61 const double y = 0.0L / 0.0L; 62 63 ATF_CHECK(isnan(pow(2.0, y)) != 0); 64 } 65 66 ATF_TC(pow_inf_neg_x); 67 ATF_TC_HEAD(pow_inf_neg_x, tc) 68 { 69 atf_tc_set_md_var(tc, "descr", "Test pow(-Inf, y) == +-Inf || +-0.0"); 70 } 71 72 ATF_TC_BODY(pow_inf_neg_x, tc) 73 { 74 const double x = -1.0L / 0.0L; 75 double z; 76 77 /* 78 * If y is odd, y > 0, and x is -Inf, -Inf is returned. 79 * If y is even, y > 0, and x is -Inf, +Inf is returned. 80 */ 81 z = pow(x, 3.0); 82 83 if (isinf(z) == 0 || signbit(z) == 0) 84 atf_tc_fail_nonfatal("pow(-Inf, 3.0) != -Inf"); 85 86 z = pow(x, 4.0); 87 88 if (isinf(z) == 0 || signbit(z) != 0) 89 atf_tc_fail_nonfatal("pow(-Inf, 4.0) != +Inf"); 90 91 /* 92 * If y is odd, y < 0, and x is -Inf, -0.0 is returned. 93 * If y is even, y < 0, and x is -Inf, +0.0 is returned. 94 */ 95 z = pow(x, -3.0); 96 97 if (fabs(z) > 0.0 || signbit(z) == 0) 98 atf_tc_fail_nonfatal("pow(-Inf, -3.0) != -0.0"); 99 100 z = pow(x, -4.0); 101 102 if (fabs(z) > 0.0 || signbit(z) != 0) 103 atf_tc_fail_nonfatal("pow(-Inf -4.0) != +0.0"); 104 } 105 106 ATF_TC(pow_inf_neg_y); 107 ATF_TC_HEAD(pow_inf_neg_y, tc) 108 { 109 atf_tc_set_md_var(tc, "descr", "Test pow(x, -Inf) == +Inf || +0.0"); 110 } 111 112 ATF_TC_BODY(pow_inf_neg_y, tc) 113 { 114 const double y = -1.0L / 0.0L; 115 double z; 116 117 /* 118 * If |x| < 1 and y is -Inf, +Inf is returned. 119 * If |x| > 1 and y is -Inf, +0.0 is returned. 120 */ 121 z = pow(0.1, y); 122 123 if (isinf(z) == 0 || signbit(z) != 0) 124 atf_tc_fail_nonfatal("pow(0.1, -Inf) != +Inf"); 125 126 z = pow(1.1, y); 127 128 if (fabs(z) > 0.0 || signbit(z) != 0) 129 atf_tc_fail_nonfatal("pow(1.1, -Inf) != +0.0"); 130 } 131 132 ATF_TC(pow_inf_pos_x); 133 ATF_TC_HEAD(pow_inf_pos_x, tc) 134 { 135 atf_tc_set_md_var(tc, "descr", "Test pow(+Inf, y) == +Inf || +0.0"); 136 } 137 138 ATF_TC_BODY(pow_inf_pos_x, tc) 139 { 140 const double x = 1.0L / 0.0L; 141 double z; 142 143 /* 144 * For y < 0, if x is +Inf, +0.0 is returned. 145 * For y > 0, if x is +Inf, +Inf is returned. 146 */ 147 z = pow(x, -2.0); 148 149 if (fabs(z) > 0.0 || signbit(z) != 0) 150 atf_tc_fail_nonfatal("pow(+Inf, -2.0) != +0.0"); 151 152 z = pow(x, 2.0); 153 154 if (isinf(z) == 0 || signbit(z) != 0) 155 atf_tc_fail_nonfatal("pow(+Inf, 2.0) != +Inf"); 156 } 157 158 ATF_TC(pow_inf_pos_y); 159 ATF_TC_HEAD(pow_inf_pos_y, tc) 160 { 161 atf_tc_set_md_var(tc, "descr", "Test pow(x, +Inf) == +Inf || +0.0"); 162 } 163 164 ATF_TC_BODY(pow_inf_pos_y, tc) 165 { 166 const double y = 1.0L / 0.0L; 167 double z; 168 169 /* 170 * If |x| < 1 and y is +Inf, +0.0 is returned. 171 * If |x| > 1 and y is +Inf, +Inf is returned. 172 */ 173 z = pow(0.1, y); 174 175 if (fabs(z) > 0.0 || signbit(z) != 0) 176 atf_tc_fail_nonfatal("pow(0.1, +Inf) != +0.0"); 177 178 z = pow(1.1, y); 179 180 if (isinf(z) == 0 || signbit(z) != 0) 181 atf_tc_fail_nonfatal("pow(1.1, +Inf) != +Inf"); 182 } 183 184 ATF_TC(pow_one_neg_x); 185 ATF_TC_HEAD(pow_one_neg_x, tc) 186 { 187 atf_tc_set_md_var(tc, "descr", "Test pow(-1.0, +-Inf) == 1.0"); 188 } 189 190 ATF_TC_BODY(pow_one_neg_x, tc) 191 { 192 const double infp = 1.0L / 0.0L; 193 const double infn = -1.0L / 0.0L; 194 195 /* 196 * If x is -1.0, and y is +-Inf, 1.0 shall be returned. 197 */ 198 ATF_REQUIRE(isinf(infp) != 0); 199 ATF_REQUIRE(isinf(infn) != 0); 200 201 if (pow(-1.0, infp) != 1.0) { 202 atf_tc_expect_fail("PR lib/45372"); 203 atf_tc_fail_nonfatal("pow(-1.0, +Inf) != 1.0"); 204 } 205 206 if (pow(-1.0, infn) != 1.0) { 207 atf_tc_expect_fail("PR lib/45372"); 208 atf_tc_fail_nonfatal("pow(-1.0, -Inf) != 1.0"); 209 } 210 } 211 212 ATF_TC(pow_one_pos_x); 213 ATF_TC_HEAD(pow_one_pos_x, tc) 214 { 215 atf_tc_set_md_var(tc, "descr", "Test pow(1.0, y) == 1.0"); 216 } 217 218 ATF_TC_BODY(pow_one_pos_x, tc) 219 { 220 const double y[] = { 0.0, 0.1, 2.0, -3.0, 99.0, 99.99, 9999999.9 }; 221 const double z = 0.0L / 0.0L; 222 size_t i; 223 224 /* 225 * For any value of y (including NaN), 226 * if x is 1.0, 1.0 shall be returned. 227 */ 228 if (pow(1.0, z) != 1.0) 229 atf_tc_fail_nonfatal("pow(1.0, NaN) != 1.0"); 230 231 for (i = 0; i < __arraycount(y); i++) { 232 233 if (pow(1.0, y[i]) != 1.0) 234 atf_tc_fail_nonfatal("pow(1.0, %0.01f) != 1.0", y[i]); 235 } 236 } 237 238 ATF_TC(pow_zero_x); 239 ATF_TC_HEAD(pow_zero_x, tc) 240 { 241 atf_tc_set_md_var(tc, "descr", "Test pow(+-0.0, y) == +-0.0 || HUGE"); 242 } 243 244 ATF_TC_BODY(pow_zero_x, tc) 245 { 246 double z; 247 248 /* 249 * If x is +0.0 or -0.0, y > 0, and y 250 * is an odd integer, x is returned. 251 */ 252 z = pow(+0.0, 3.0); 253 254 if (fabs(z) > 0.0 || signbit(z) != 0) 255 atf_tc_fail_nonfatal("pow(+0.0, 3.0) != +0.0"); 256 257 z = pow(-0.0, 3.0); 258 259 if (fabs(z) > 0.0 || signbit(z) == 0) 260 atf_tc_fail_nonfatal("pow(-0.0, 3.0) != -0.0"); 261 262 /* 263 * If y > 0 and not an odd integer, 264 * if x is +0.0 or -0.0, +0.0 is returned. 265 */ 266 z = pow(+0.0, 4.0); 267 268 if (fabs(z) > 0.0 || signbit(z) != 0) 269 atf_tc_fail_nonfatal("pow(+0.0, 4.0) != +0.0"); 270 271 z = pow(-0.0, 4.0); 272 273 if (fabs(z) > 0.0 || signbit(z) != 0) 274 atf_tc_fail_nonfatal("pow(-0.0, 4.0) != +0.0"); 275 276 /* 277 * If y < 0 and x is +0.0 or -0.0, either +-HUGE_VAL, 278 * +-HUGE_VALF, or +-HUGE_VALL shall be returned. 279 */ 280 z = pow(+0.0, -4.0); 281 282 if (z != HUGE_VAL) { 283 atf_tc_expect_fail("PR port-amd64/45391"); 284 atf_tc_fail_nonfatal("pow(+0.0, -4.0) != HUGE_VAL"); 285 } 286 287 z = pow(-0.0, -4.0); 288 289 if (z != HUGE_VAL) { 290 atf_tc_expect_fail("PR port-amd64/45391"); 291 atf_tc_fail_nonfatal("pow(-0.0, -4.0) != HUGE_VAL"); 292 } 293 294 z = pow(+0.0, -5.0); 295 296 if (z != HUGE_VAL) { 297 atf_tc_expect_fail("PR port-amd64/45391"); 298 atf_tc_fail_nonfatal("pow(+0.0, -5.0) != HUGE_VAL"); 299 } 300 301 z = pow(-0.0, -5.0); 302 303 if (z != -HUGE_VAL) 304 atf_tc_fail_nonfatal("pow(-0.0, -5.0) != -HUGE_VAL"); 305 } 306 307 ATF_TC(pow_zero_y); 308 ATF_TC_HEAD(pow_zero_y, tc) 309 { 310 atf_tc_set_md_var(tc, "descr", "Test pow(x, +-0.0) == 1.0"); 311 } 312 313 ATF_TC_BODY(pow_zero_y, tc) 314 { 315 const double x[] = { 0.1, -3.0, 77.0, 99.99, 101.0000001 }; 316 const double z = 0.0L / 0.0L; 317 size_t i; 318 319 /* 320 * For any value of x (including NaN), 321 * if y is +0.0 or -0.0, 1.0 is returned. 322 */ 323 if (pow(z, +0.0) != 1.0) 324 atf_tc_fail_nonfatal("pow(NaN, +0.0) != 1.0"); 325 326 if (pow(z, -0.0) != 1.0) 327 atf_tc_fail_nonfatal("pow(NaN, -0.0) != 1.0"); 328 329 for (i = 0; i < __arraycount(x); i++) { 330 331 if (pow(x[i], +0.0) != 1.0) 332 atf_tc_fail_nonfatal("pow(%0.01f, +0.0) != 1.0", x[i]); 333 334 if (pow(x[i], -0.0) != 1.0) 335 atf_tc_fail_nonfatal("pow(%0.01f, -0.0) != 1.0", x[i]); 336 } 337 } 338 339 /* 340 * powf(3) 341 */ 342 ATF_TC(powf_nan_x); 343 ATF_TC_HEAD(powf_nan_x, tc) 344 { 345 atf_tc_set_md_var(tc, "descr", "Test powf(NaN, y) == NaN"); 346 } 347 348 ATF_TC_BODY(powf_nan_x, tc) 349 { 350 const float x = 0.0L / 0.0L; 351 352 ATF_CHECK(isnanf(powf(x, 2.0)) != 0); 353 } 354 355 ATF_TC(powf_nan_y); 356 ATF_TC_HEAD(powf_nan_y, tc) 357 { 358 atf_tc_set_md_var(tc, "descr", "Test powf(x, NaN) == NaN"); 359 } 360 361 ATF_TC_BODY(powf_nan_y, tc) 362 { 363 const float y = 0.0L / 0.0L; 364 365 ATF_CHECK(isnanf(powf(2.0, y)) != 0); 366 } 367 368 ATF_TC(powf_inf_neg_x); 369 ATF_TC_HEAD(powf_inf_neg_x, tc) 370 { 371 atf_tc_set_md_var(tc, "descr", "Test powf(-Inf, y) == +-Inf || +-0.0"); 372 } 373 374 ATF_TC_BODY(powf_inf_neg_x, tc) 375 { 376 const float x = -1.0L / 0.0L; 377 float z; 378 379 /* 380 * If y is odd, y > 0, and x is -Inf, -Inf is returned. 381 * If y is even, y > 0, and x is -Inf, +Inf is returned. 382 */ 383 z = powf(x, 3.0); 384 385 if (isinff(z) == 0 || signbit(z) == 0) 386 atf_tc_fail_nonfatal("powf(-Inf, 3.0) != -Inf"); 387 388 z = powf(x, 4.0); 389 390 if (isinff(z) == 0 || signbit(z) != 0) 391 atf_tc_fail_nonfatal("powf(-Inf, 4.0) != +Inf"); 392 393 /* 394 * If y is odd, y < 0, and x is -Inf, -0.0 is returned. 395 * If y is even, y < 0, and x is -Inf, +0.0 is returned. 396 */ 397 z = powf(x, -3.0); 398 399 if (fabsf(z) > 0.0 || signbit(z) == 0) { 400 atf_tc_expect_fail("PR lib/45372"); 401 atf_tc_fail_nonfatal("powf(-Inf, -3.0) != -0.0"); 402 } 403 404 z = powf(x, -4.0); 405 406 if (fabsf(z) > 0.0 || signbit(z) != 0) 407 atf_tc_fail_nonfatal("powf(-Inf -4.0) != +0.0"); 408 } 409 410 ATF_TC(powf_inf_neg_y); 411 ATF_TC_HEAD(powf_inf_neg_y, tc) 412 { 413 atf_tc_set_md_var(tc, "descr", "Test powf(x, -Inf) == +Inf || +0.0"); 414 } 415 416 ATF_TC_BODY(powf_inf_neg_y, tc) 417 { 418 const float y = -1.0L / 0.0L; 419 float z; 420 421 /* 422 * If |x| < 1 and y is -Inf, +Inf is returned. 423 * If |x| > 1 and y is -Inf, +0.0 is returned. 424 */ 425 z = powf(0.1, y); 426 427 if (isinff(z) == 0 || signbit(z) != 0) 428 atf_tc_fail_nonfatal("powf(0.1, -Inf) != +Inf"); 429 430 z = powf(1.1, y); 431 432 if (fabsf(z) > 0.0 || signbit(z) != 0) 433 atf_tc_fail_nonfatal("powf(1.1, -Inf) != +0.0"); 434 } 435 436 ATF_TC(powf_inf_pos_x); 437 ATF_TC_HEAD(powf_inf_pos_x, tc) 438 { 439 atf_tc_set_md_var(tc, "descr", "Test powf(+Inf, y) == +Inf || +0.0"); 440 } 441 442 ATF_TC_BODY(powf_inf_pos_x, tc) 443 { 444 const float x = 1.0L / 0.0L; 445 float z; 446 447 /* 448 * For y < 0, if x is +Inf, +0.0 is returned. 449 * For y > 0, if x is +Inf, +Inf is returned. 450 */ 451 z = powf(x, -2.0); 452 453 if (fabsf(z) > 0.0 || signbit(z) != 0) 454 atf_tc_fail_nonfatal("powf(+Inf, -2.0) != +0.0"); 455 456 z = powf(x, 2.0); 457 458 if (isinff(z) == 0 || signbit(z) != 0) 459 atf_tc_fail_nonfatal("powf(+Inf, 2.0) != +Inf"); 460 } 461 462 ATF_TC(powf_inf_pos_y); 463 ATF_TC_HEAD(powf_inf_pos_y, tc) 464 { 465 atf_tc_set_md_var(tc, "descr", "Test powf(x, +Inf) == +Inf || +0.0"); 466 } 467 468 ATF_TC_BODY(powf_inf_pos_y, tc) 469 { 470 const float y = 1.0L / 0.0L; 471 float z; 472 473 /* 474 * If |x| < 1 and y is +Inf, +0.0 is returned. 475 * If |x| > 1 and y is +Inf, +Inf is returned. 476 */ 477 z = powf(0.1, y); 478 479 if (fabsf(z) > 0.0 || signbit(z) != 0) 480 atf_tc_fail_nonfatal("powf(0.1, +Inf) != +0.0"); 481 482 z = powf(1.1, y); 483 484 if (isinff(z) == 0 || signbit(z) != 0) 485 atf_tc_fail_nonfatal("powf(1.1, +Inf) != +Inf"); 486 } 487 488 ATF_TC(powf_one_neg_x); 489 ATF_TC_HEAD(powf_one_neg_x, tc) 490 { 491 atf_tc_set_md_var(tc, "descr", "Test powf(-1.0, +-Inf) == 1.0"); 492 } 493 494 ATF_TC_BODY(powf_one_neg_x, tc) 495 { 496 const float infp = 1.0L / 0.0L; 497 const float infn = -1.0L / 0.0L; 498 499 /* 500 * If x is -1.0, and y is +-Inf, 1.0 shall be returned. 501 */ 502 ATF_REQUIRE(isinff(infp) != 0); 503 ATF_REQUIRE(isinff(infn) != 0); 504 505 if (powf(-1.0, infp) != 1.0) { 506 atf_tc_expect_fail("PR lib/45372"); 507 atf_tc_fail_nonfatal("powf(-1.0, +Inf) != 1.0"); 508 } 509 510 if (powf(-1.0, infn) != 1.0) { 511 atf_tc_expect_fail("PR lib/45372"); 512 atf_tc_fail_nonfatal("powf(-1.0, -Inf) != 1.0"); 513 } 514 } 515 516 ATF_TC(powf_one_pos_x); 517 ATF_TC_HEAD(powf_one_pos_x, tc) 518 { 519 atf_tc_set_md_var(tc, "descr", "Test powf(1.0, y) == 1.0"); 520 } 521 522 ATF_TC_BODY(powf_one_pos_x, tc) 523 { 524 const float y[] = { 0.0, 0.1, 2.0, -3.0, 99.0, 99.99, 9999999.9 }; 525 const float z = 0.0L / 0.0L; 526 size_t i; 527 528 /* 529 * For any value of y (including NaN), 530 * if x is 1.0, 1.0 shall be returned. 531 */ 532 if (powf(1.0, z) != 1.0) 533 atf_tc_fail_nonfatal("powf(1.0, NaN) != 1.0"); 534 535 for (i = 0; i < __arraycount(y); i++) { 536 537 if (powf(1.0, y[i]) != 1.0) 538 atf_tc_fail_nonfatal("powf(1.0, %0.01f) != 1.0", y[i]); 539 } 540 } 541 542 ATF_TC(powf_zero_x); 543 ATF_TC_HEAD(powf_zero_x, tc) 544 { 545 atf_tc_set_md_var(tc, "descr", "Test powf(+-0.0, y) == +-0.0 || HUGE"); 546 } 547 548 ATF_TC_BODY(powf_zero_x, tc) 549 { 550 float z; 551 552 /* 553 * If x is +0.0 or -0.0, y > 0, and y 554 * is an odd integer, x is returned. 555 */ 556 z = powf(+0.0, 3.0); 557 558 if (fabsf(z) > 0.0 || signbit(z) != 0) 559 atf_tc_fail_nonfatal("powf(+0.0, 3.0) != +0.0"); 560 561 z = powf(-0.0, 3.0); 562 563 if (fabsf(z) > 0.0 || signbit(z) == 0) 564 atf_tc_fail_nonfatal("powf(-0.0, 3.0) != -0.0"); 565 566 /* 567 * If y > 0 and not an odd integer, 568 * if x is +0.0 or -0.0, +0.0 is returned. 569 */ 570 z = powf(+0.0, 4.0); 571 572 if (fabsf(z) > 0.0 || signbit(z) != 0) 573 atf_tc_fail_nonfatal("powf(+0.0, 4.0) != +0.0"); 574 575 z = powf(-0.0, 4.0); 576 577 if (fabsf(z) > 0.0 || signbit(z) != 0) 578 atf_tc_fail_nonfatal("powf(-0.0, 4.0) != +0.0"); 579 580 /* 581 * If y < 0 and x is +0.0 or -0.0, either +-HUGE_VAL, 582 * +-HUGE_VALF, or +-HUGE_VALL shall be returned. 583 */ 584 z = powf(+0.0, -4.0); 585 586 if (z != HUGE_VALF) { 587 atf_tc_expect_fail("PR port-amd64/45391"); 588 atf_tc_fail_nonfatal("powf(+0.0, -4.0) != HUGE_VALF"); 589 } 590 591 z = powf(-0.0, -4.0); 592 593 if (z != HUGE_VALF) { 594 atf_tc_expect_fail("PR port-amd64/45391"); 595 atf_tc_fail_nonfatal("powf(-0.0, -4.0) != HUGE_VALF"); 596 } 597 598 z = powf(+0.0, -5.0); 599 600 if (z != HUGE_VALF) { 601 atf_tc_expect_fail("PR port-amd64/45391"); 602 atf_tc_fail_nonfatal("powf(+0.0, -5.0) != HUGE_VALF"); 603 } 604 605 z = powf(-0.0, -5.0); 606 607 if (z != -HUGE_VALF) 608 atf_tc_fail_nonfatal("powf(-0.0, -5.0) != -HUGE_VALF"); 609 } 610 611 ATF_TC(powf_zero_y); 612 ATF_TC_HEAD(powf_zero_y, tc) 613 { 614 atf_tc_set_md_var(tc, "descr", "Test powf(x, +-0.0) == 1.0"); 615 } 616 617 ATF_TC_BODY(powf_zero_y, tc) 618 { 619 const float x[] = { 0.1, -3.0, 77.0, 99.99, 101.0000001 }; 620 const float z = 0.0L / 0.0L; 621 size_t i; 622 623 /* 624 * For any value of x (including NaN), 625 * if y is +0.0 or -0.0, 1.0 is returned. 626 */ 627 if (powf(z, +0.0) != 1.0) 628 atf_tc_fail_nonfatal("powf(NaN, +0.0) != 1.0"); 629 630 if (powf(z, -0.0) != 1.0) 631 atf_tc_fail_nonfatal("powf(NaN, -0.0) != 1.0"); 632 633 for (i = 0; i < __arraycount(x); i++) { 634 635 if (powf(x[i], +0.0) != 1.0) 636 atf_tc_fail_nonfatal("powf(%0.01f, +0.0) != 1.0",x[i]); 637 638 if (powf(x[i], -0.0) != 1.0) 639 atf_tc_fail_nonfatal("powf(%0.01f, -0.0) != 1.0",x[i]); 640 } 641 } 642 643 ATF_TP_ADD_TCS(tp) 644 { 645 646 ATF_TP_ADD_TC(tp, pow_nan_x); 647 ATF_TP_ADD_TC(tp, pow_nan_y); 648 ATF_TP_ADD_TC(tp, pow_inf_neg_x); 649 ATF_TP_ADD_TC(tp, pow_inf_neg_y); 650 ATF_TP_ADD_TC(tp, pow_inf_pos_x); 651 ATF_TP_ADD_TC(tp, pow_inf_pos_y); 652 ATF_TP_ADD_TC(tp, pow_one_neg_x); 653 ATF_TP_ADD_TC(tp, pow_one_pos_x); 654 ATF_TP_ADD_TC(tp, pow_zero_x); 655 ATF_TP_ADD_TC(tp, pow_zero_y); 656 657 ATF_TP_ADD_TC(tp, powf_nan_x); 658 ATF_TP_ADD_TC(tp, powf_nan_y); 659 ATF_TP_ADD_TC(tp, powf_inf_neg_x); 660 ATF_TP_ADD_TC(tp, powf_inf_neg_y); 661 ATF_TP_ADD_TC(tp, powf_inf_pos_x); 662 ATF_TP_ADD_TC(tp, powf_inf_pos_y); 663 ATF_TP_ADD_TC(tp, powf_one_neg_x); 664 ATF_TP_ADD_TC(tp, powf_one_pos_x); 665 ATF_TP_ADD_TC(tp, powf_zero_x); 666 ATF_TP_ADD_TC(tp, powf_zero_y); 667 668 return atf_no_error(); 669 } 670