1 /* Test file for in-place operations. 2 3 Copyright 2000-2020 Free Software Foundation, Inc. 4 Contributed by the AriC and Caramba projects, INRIA. 5 6 This file is part of the GNU MPFR Library. 7 8 The GNU MPFR Library is free software; you can redistribute it and/or modify 9 it under the terms of the GNU Lesser General Public License as published by 10 the Free Software Foundation; either version 3 of the License, or (at your 11 option) any later version. 12 13 The GNU MPFR Library is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 16 License for more details. 17 18 You should have received a copy of the GNU Lesser General Public License 19 along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see 20 https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 21 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ 22 23 #include "mpfr-test.h" 24 25 #define DISP(s,t) \ 26 do \ 27 { \ 28 printf (s); \ 29 mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN); \ 30 } \ 31 while (0) 32 33 #define DISP2(s,t) do { DISP(s,t); putchar ('\n'); } while (0) 34 35 #define SPECIAL_MAX 12 36 37 static void 38 set_special (mpfr_ptr x, unsigned int select) 39 { 40 MPFR_ASSERTN (select < SPECIAL_MAX); 41 switch (select) 42 { 43 case 0: 44 MPFR_SET_NAN (x); 45 break; 46 case 1: 47 MPFR_SET_INF (x); 48 MPFR_SET_POS (x); 49 break; 50 case 2: 51 MPFR_SET_INF (x); 52 MPFR_SET_NEG (x); 53 break; 54 case 3: 55 MPFR_SET_ZERO (x); 56 MPFR_SET_POS (x); 57 break; 58 case 4: 59 MPFR_SET_ZERO (x); 60 MPFR_SET_NEG (x); 61 break; 62 case 5: 63 mpfr_set_str_binary (x, "1"); 64 break; 65 case 6: 66 mpfr_set_str_binary (x, "-1"); 67 break; 68 case 7: 69 mpfr_set_str_binary (x, "1e-1"); 70 break; 71 case 8: 72 mpfr_set_str_binary (x, "1e+1"); 73 break; 74 case 9: 75 mpfr_const_pi (x, MPFR_RNDN); 76 break; 77 case 10: 78 mpfr_const_pi (x, MPFR_RNDN); 79 MPFR_SET_EXP (x, MPFR_GET_EXP (x)-1); 80 break; 81 default: 82 mpfr_urandomb (x, RANDS); 83 if (randlimb () & 1) 84 mpfr_neg (x, x, MPFR_RNDN); 85 break; 86 } 87 } 88 /* same than mpfr_cmp, but returns 0 for both NaN's */ 89 static int 90 mpfr_compare (mpfr_srcptr a, mpfr_srcptr b) 91 { 92 return (MPFR_IS_NAN(a)) ? !MPFR_IS_NAN(b) : 93 (MPFR_IS_NAN(b) || mpfr_cmp(a, b)); 94 } 95 96 static void 97 test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t), 98 const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd) 99 { 100 mpfr_t ref1, ref2, ref3; 101 mpfr_t res1; 102 int i; 103 104 #ifdef MPFR_DEBUG 105 printf ("checking %s\n", foo); 106 #endif 107 mpfr_init2 (ref1, prec); 108 mpfr_init2 (ref2, prec); 109 mpfr_init2 (ref3, prec); 110 mpfr_init2 (res1, prec); 111 112 /* for each variable, consider each of the following 6 possibilities: 113 NaN, +Infinity, -Infinity, +0, -0 or a random number */ 114 for (i=0; i < SPECIAL_MAX*SPECIAL_MAX ; i++) 115 { 116 set_special (ref2, i%SPECIAL_MAX); 117 set_special (ref3, i/SPECIAL_MAX); 118 119 /* reference call: foo(a, b, c) */ 120 testfunc (ref1, ref2, ref3, rnd); 121 122 /* foo(a, a, c) */ 123 mpfr_set (res1, ref2, rnd); /* exact operation */ 124 testfunc (res1, res1, ref3, rnd); 125 126 if (mpfr_compare (res1, ref1)) 127 { 128 printf ("Error for %s(a, a, c) with %s for ", foo, 129 mpfr_print_rnd_mode (rnd)); 130 DISP("a=",ref2); DISP2(", c=",ref3); 131 printf ("expected "); mpfr_dump (ref1); 132 printf ("got "); mpfr_dump (res1); 133 exit (1); 134 } 135 136 /* foo(a, b, a) */ 137 mpfr_set (res1, ref3, rnd); 138 testfunc (res1, ref2, res1, rnd); 139 if (mpfr_compare (res1, ref1)) 140 { 141 printf ("Error for %s(a, b, a) for ", foo); 142 DISP("b=",ref2); DISP2(", a=", ref3); 143 DISP("expected ", ref1); DISP2(", got ",res1); 144 exit (1); 145 } 146 147 /* foo(a, a, a) */ 148 mpfr_set (ref3, ref2, rnd); 149 testfunc (ref1, ref2, ref3, rnd); 150 mpfr_set (res1, ref2, rnd); 151 testfunc (res1, res1, res1, rnd); 152 153 if (mpfr_compare (res1, ref1)) 154 { 155 printf ("Error for %s(a, a, a) for ", foo); 156 DISP2("a=",ref2); 157 DISP("expected ", ref1); DISP2(", got ", res1); 158 exit (1); 159 } 160 } 161 162 mpfr_clear (ref1); 163 mpfr_clear (ref2); 164 mpfr_clear (ref3); 165 mpfr_clear (res1); 166 } 167 168 static void 169 test4 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr, 170 mpfr_rnd_t), 171 const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd) 172 { 173 mpfr_t ref, op1, op2, op3; 174 mpfr_t res; 175 int i, j, k; 176 177 #ifdef MPFR_DEBUG 178 printf ("checking %s\n", foo); 179 #endif 180 mpfr_init2 (ref, prec); 181 mpfr_init2 (op1, prec); 182 mpfr_init2 (op2, prec); 183 mpfr_init2 (op3, prec); 184 mpfr_init2 (res, prec); 185 186 /* for each variable, consider each of the following 6 possibilities: 187 NaN, +Infinity, -Infinity, +0, -0 or a random number */ 188 189 for (i=0; i<SPECIAL_MAX; i++) 190 { 191 set_special (op1, i); 192 for (j=0; j<SPECIAL_MAX; j++) 193 { 194 set_special (op2, j); 195 for (k=0; k<SPECIAL_MAX; k++) 196 { 197 set_special (op3, k); 198 199 /* reference call: foo(s, a, b, c) */ 200 testfunc (ref, op1, op2, op3, rnd); 201 202 /* foo(a, a, b, c) */ 203 mpfr_set (res, op1, rnd); /* exact operation */ 204 testfunc (res, res, op2, op3, rnd); 205 206 if (mpfr_compare (res, ref)) 207 { 208 printf ("Error for %s(a, a, b, c) for ", foo); 209 DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3); 210 DISP("expected ", ref); DISP2(", got ", res); 211 exit (1); 212 } 213 214 /* foo(b, a, b, c) */ 215 mpfr_set (res, op2, rnd); 216 testfunc (res, op1, res, op3, rnd); 217 218 if (mpfr_compare (res, ref)) 219 { 220 printf ("Error for %s(a, a, b, c) for ", foo); 221 DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3); 222 DISP("expected ", ref); DISP2(", got ", res); 223 exit (1); 224 } 225 226 /* foo(c, a, b, c) */ 227 mpfr_set (res, op3, rnd); 228 testfunc (res, op1, op2, res, rnd); 229 230 if (mpfr_compare (res, ref)) 231 { 232 printf ("Error for %s(a, a, b, c) for ", foo); 233 DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3); 234 DISP("expected ", ref); DISP2(", got ", res); 235 exit (1); 236 } 237 238 /* foo(a, a, a,c) */ 239 testfunc (ref, op1, op1, op3, rnd); 240 mpfr_set (res, op1, rnd); 241 testfunc (res, res, res, op3, rnd); 242 if (mpfr_compare (res, ref)) 243 { 244 printf ("Error for %s(a, a, b, c) for ", foo); 245 DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3); 246 DISP("expected ", ref); DISP2(", got ", res); 247 exit (1); 248 } 249 250 /* foo(a, a, b,a) */ 251 testfunc (ref, op1, op2, op1, rnd); 252 mpfr_set (res, op1, rnd); 253 testfunc (res, res, op2, res, rnd); 254 if (mpfr_compare (res, ref)) 255 { 256 printf ("Error for %s(a, a, b, c) for ", foo); 257 DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3); 258 DISP("expected ", ref); DISP2(", got ", res); 259 exit (1); 260 } 261 262 /* foo(b, a, b, b) */ 263 testfunc (ref, op1, op2, op2, rnd); 264 mpfr_set (res, op2, rnd); 265 testfunc (res, op1, res, res, rnd); 266 if (mpfr_compare (res, ref)) 267 { 268 printf ("Error for %s(a, a, b, c) for ", foo); 269 DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3); 270 DISP("expected ", ref); DISP2(", got ", res); 271 exit (1); 272 } 273 274 /* foo (a, a, a, a) */ 275 testfunc (ref, op1, op1, op1 ,rnd); 276 mpfr_set (res, op1, rnd); 277 testfunc (res, res, res, res, rnd); 278 if (mpfr_compare (res, ref)) 279 { 280 printf ("Error for %s(a, a, a, a) for ", foo); 281 DISP2("a=", op1); 282 DISP("expected ", ref); DISP2(", got ", res); 283 exit (1); 284 } 285 } 286 } 287 } 288 289 mpfr_clear (ref); 290 mpfr_clear (op1); 291 mpfr_clear (op2); 292 mpfr_clear (op3); 293 mpfr_clear (res); 294 295 } 296 297 static void 298 test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mpfr_rnd_t), 299 const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd) 300 { 301 mpfr_t ref1, ref2; 302 unsigned int ref3; 303 mpfr_t res1; 304 int i; 305 306 #ifdef MPFR_DEBUG 307 printf ("checking %s\n", foo); 308 #endif 309 mpfr_init2 (ref1, prec); 310 mpfr_init2 (ref2, prec); 311 mpfr_init2 (res1, prec); 312 313 /* ref2 can be NaN, +Inf, -Inf, +0, -0 or any number 314 ref3 can be 0 or any number */ 315 for (i=0; i<SPECIAL_MAX*2; i++) 316 { 317 set_special (ref2, i%SPECIAL_MAX); 318 ref3 = i/SPECIAL_MAX == 0 ? 0 : randlimb (); 319 320 /* reference call: foo(a, b, c) */ 321 testfunc (ref1, ref2, ref3, rnd); 322 323 /* foo(a, a, c) */ 324 mpfr_set (res1, ref2, rnd); /* exact operation */ 325 testfunc (res1, res1, ref3, rnd); 326 327 if (mpfr_compare (res1, ref1)) 328 { 329 printf ("Error for %s(a, a, c) for c=%u\n", foo, ref3); 330 DISP2("a=",ref2); 331 printf ("expected "); mpfr_dump (ref1); 332 printf ("got "); mpfr_dump (res1); 333 exit (1); 334 } 335 } 336 337 mpfr_clear (ref1); 338 mpfr_clear (ref2); 339 mpfr_clear (res1); 340 } 341 342 static void 343 testui2 (int (*testfunc)(mpfr_ptr, unsigned long int, mpfr_srcptr, mpfr_rnd_t), 344 const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd) 345 { 346 mpfr_t ref1, ref3; 347 unsigned int ref2; 348 mpfr_t res1; 349 int i; 350 351 #ifdef MPFR_DEBUG 352 printf ("checking %s\n", foo); 353 #endif 354 mpfr_init2 (ref1, prec); 355 mpfr_init2 (ref3, prec); 356 mpfr_init2 (res1, prec); 357 358 for (i=0; i<SPECIAL_MAX*2; i++) 359 { 360 set_special (ref3, i%SPECIAL_MAX); 361 ref2 = i/SPECIAL_MAX==0 ? 0 : randlimb (); 362 363 /* reference call: foo(a, b, c) */ 364 testfunc (ref1, ref2, ref3, rnd); 365 366 /* foo(a, b, a) */ 367 mpfr_set (res1, ref3, rnd); /* exact operation */ 368 testfunc (res1, ref2, res1, rnd); 369 if (mpfr_compare (res1, ref1)) 370 { 371 printf ("Error for %s(a, b, a) for b=%u \n", foo, ref2); 372 DISP2("a=", ref3); 373 DISP("expected", ref1); DISP2(", got ", res1); 374 exit (1); 375 } 376 } 377 378 mpfr_clear (ref1); 379 mpfr_clear (ref3); 380 mpfr_clear (res1); 381 } 382 383 /* foo(mpfr_ptr, mpfr_srcptr, mp_rndt) */ 384 static void 385 test2 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_rnd_t), 386 const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd) 387 { 388 mpfr_t ref1, ref2; 389 mpfr_t res1; 390 int i; 391 392 #ifdef MPFR_DEBUG 393 printf ("checking %s\n", foo); 394 #endif 395 mpfr_init2 (ref1, prec); 396 mpfr_init2 (ref2, prec); 397 mpfr_init2 (res1, prec); 398 399 for (i=0; i<SPECIAL_MAX; i++) 400 { 401 set_special (ref2, i); 402 403 /* reference call: foo(a, b) */ 404 testfunc (ref1, ref2, rnd); 405 406 /* foo(a, a) */ 407 mpfr_set (res1, ref2, rnd); /* exact operation */ 408 testfunc (res1, res1, rnd); 409 if (mpfr_compare (res1, ref1)) 410 { 411 printf ("Error for %s(a, a) for ", foo); 412 DISP2("a=", ref2); 413 DISP("expected", ref1); DISP2(", got ", res1); 414 exit (1); 415 } 416 } 417 418 mpfr_clear (ref1); 419 mpfr_clear (ref2); 420 mpfr_clear (res1); 421 } 422 423 /* foo(mpfr_ptr, mpfr_srcptr) */ 424 static void 425 test2a (int (*testfunc)(mpfr_ptr, mpfr_srcptr), 426 const char *foo, mpfr_prec_t prec) 427 { 428 mpfr_t ref1, ref2; 429 mpfr_t res1; 430 int i; 431 432 #ifdef MPFR_DEBUG 433 printf ("checking %s\n", foo); 434 #endif 435 mpfr_init2 (ref1, prec); 436 mpfr_init2 (ref2, prec); 437 mpfr_init2 (res1, prec); 438 439 for (i=0; i<SPECIAL_MAX; i++) 440 { 441 set_special (ref2, i); 442 443 /* reference call: foo(a, b) */ 444 testfunc (ref1, ref2); 445 446 /* foo(a, a) */ 447 mpfr_set (res1, ref2, MPFR_RNDN); /* exact operation */ 448 testfunc (res1, res1); 449 if (mpfr_compare (res1, ref1)) 450 { 451 printf ("Error for %s(a, a) for ", foo); 452 DISP2("a=",ref2); 453 DISP("expected", ref1); DISP2(", got ", res1); 454 exit (1); 455 } 456 } 457 458 mpfr_clear (ref1); 459 mpfr_clear (ref2); 460 mpfr_clear (res1); 461 } 462 463 /* one operand, two results */ 464 static void 465 test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t), 466 const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd) 467 { 468 mpfr_t ref1, ref2, ref3; 469 mpfr_t res1, res2; 470 int i; 471 472 #ifdef MPFR_DEBUG 473 printf ("checking %s\n", foo); 474 #endif 475 mpfr_init2 (ref1, prec); 476 mpfr_init2 (ref2, prec); 477 mpfr_init2 (ref3, prec); 478 mpfr_init2 (res1, prec); 479 mpfr_init2 (res2, prec); 480 481 for (i=0; i<SPECIAL_MAX; i++) 482 { 483 set_special (ref3, i); 484 485 /* reference call: foo(a, b, c) */ 486 testfunc (ref1, ref2, ref3, rnd); 487 488 /* foo(a, b, a) */ 489 mpfr_set (res1, ref3, rnd); /* exact operation */ 490 testfunc (res1, res2, res1, rnd); 491 if (mpfr_compare (res1, ref1) || mpfr_compare (res2, ref2)) 492 { 493 printf ("Error for %s(a, b, a) for rnd=%s, ", foo, 494 mpfr_print_rnd_mode (rnd)); 495 DISP2("a=",ref3); 496 DISP("expected (", ref1); DISP(",",ref2); 497 DISP("), got (", res1); DISP(",", res2); printf(")\n"); 498 exit (1); 499 } 500 501 /* foo(a, b, b) */ 502 mpfr_set (res2, ref3, rnd); /* exact operation */ 503 testfunc (res1, res2, res2, rnd); 504 if (mpfr_compare (res1, ref1) || mpfr_compare (res2, ref2)) 505 { 506 printf ("Error for %s(a, b, b) for ", foo); 507 DISP2("b=",ref3); 508 DISP("expected (", ref1); DISP(",",ref2); 509 DISP("), got (", res1); DISP(",", res2); printf(")\n"); 510 exit (1); 511 } 512 } 513 514 mpfr_clear (ref1); 515 mpfr_clear (ref2); 516 mpfr_clear (ref3); 517 mpfr_clear (res1); 518 mpfr_clear (res2); 519 } 520 521 static int 522 reldiff_wrapper (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) 523 { 524 mpfr_reldiff (a, b, c, rnd_mode); 525 return 0; 526 } 527 528 static void 529 pow_int (mpfr_rnd_t rnd) 530 { 531 mpfr_t ref1, ref2, ref3; 532 mpfr_t res1; 533 int i; 534 535 #ifdef MPFR_DEBUG 536 printf ("pow_int\n"); 537 #endif 538 mpfr_inits2 ((randlimb () % 200) + MPFR_PREC_MIN, 539 ref1, ref2, res1, (mpfr_ptr) 0); 540 mpfr_init2 (ref3, 1005); 541 542 for (i = 0; i <= 15; i++) 543 { 544 mpfr_urandomb (ref2, RANDS); 545 if (i & 1) 546 mpfr_neg (ref2, ref2, MPFR_RNDN); 547 mpfr_set_ui (ref3, 20, MPFR_RNDN); 548 /* We need to test huge integers because different algorithms/codes 549 are used for not-too-large integers (mpfr_pow_z) and for general 550 cases, in particular huge integers (mpfr_pow_general). [r7606] */ 551 if (i & 2) 552 mpfr_mul_2ui (ref3, ref3, 1000, MPFR_RNDN); 553 if (i & 4) 554 mpfr_add_ui (ref3, ref3, 1, MPFR_RNDN); /* odd integer */ 555 556 /* reference call: pow(a, b, c) */ 557 mpfr_pow (ref1, ref2, ref3, rnd); 558 559 /* pow(a, a, c) */ 560 mpfr_set (res1, ref2, rnd); /* exact operation */ 561 mpfr_pow (res1, res1, ref3, rnd); 562 563 if (mpfr_compare (res1, ref1)) 564 { 565 printf ("Error for pow_int(a, a, c) for "); 566 DISP("a=",ref2); DISP2(", c=",ref3); 567 printf ("expected "); mpfr_dump (ref1); 568 printf ("got "); mpfr_dump (res1); 569 exit (1); 570 } 571 } 572 573 mpfr_clears (ref1, ref2, ref3, res1, (mpfr_ptr) 0); 574 } 575 576 int 577 main (void) 578 { 579 int i, rnd; 580 mpfr_prec_t p; 581 582 tests_start_mpfr (); 583 584 for (i = 1; i <= 5; i++) 585 { 586 /* Test on i limb(s), with a random number of trailing bits. */ 587 p = GMP_NUMB_BITS * i - (randlimb () % GMP_NUMB_BITS); 588 if (p < MPFR_PREC_MIN) 589 p = MPFR_PREC_MIN; 590 591 RND_LOOP (rnd) 592 { 593 test2a (mpfr_round, "mpfr_round", p); 594 test2a (mpfr_ceil, "mpfr_ceil", p); 595 test2a (mpfr_floor, "mpfr_floor", p); 596 test2a (mpfr_trunc, "mpfr_trunc", p); 597 598 test2ui (mpfr_add_ui, "mpfr_add_ui", p, (mpfr_rnd_t) rnd); 599 test2ui (mpfr_div_2exp, "mpfr_div_2exp", p, (mpfr_rnd_t) rnd); 600 test2ui (mpfr_div_2ui, "mpfr_div_2ui", p, (mpfr_rnd_t) rnd); 601 test2ui (mpfr_div_ui, "mpfr_div_ui", p, (mpfr_rnd_t) rnd); 602 test2ui (mpfr_mul_2exp, "mpfr_mul_2exp", p, (mpfr_rnd_t) rnd); 603 test2ui (mpfr_mul_2ui, "mpfr_mul_2ui", p, (mpfr_rnd_t) rnd); 604 test2ui (mpfr_mul_ui, "mpfr_mul_ui", p, (mpfr_rnd_t) rnd); 605 test2ui (mpfr_pow_ui, "mpfr_pow_ui", p, (mpfr_rnd_t) rnd); 606 test2ui (mpfr_sub_ui, "mpfr_sub_ui", p, (mpfr_rnd_t) rnd); 607 608 testui2 (mpfr_ui_div, "mpfr_ui_div", p, (mpfr_rnd_t) rnd); 609 testui2 (mpfr_ui_sub, "mpfr_ui_sub", p, (mpfr_rnd_t) rnd); 610 testui2 (mpfr_ui_pow, "mpfr_ui_pow", p, (mpfr_rnd_t) rnd); 611 612 test2 (mpfr_sqr, "mpfr_sqr", p, (mpfr_rnd_t) rnd); 613 test2 (mpfr_sqrt, "mpfr_sqrt", p, (mpfr_rnd_t) rnd); 614 test2 (mpfr_abs, "mpfr_abs", p, (mpfr_rnd_t) rnd); 615 test2 (mpfr_neg, "mpfr_neg", p, (mpfr_rnd_t) rnd); 616 617 test2 (mpfr_log, "mpfr_log", p, (mpfr_rnd_t) rnd); 618 test2 (mpfr_log2, "mpfr_log2", p, (mpfr_rnd_t) rnd); 619 test2 (mpfr_log10, "mpfr_log10", p, (mpfr_rnd_t) rnd); 620 test2 (mpfr_log1p, "mpfr_log1p", p, (mpfr_rnd_t) rnd); 621 622 test2 (mpfr_exp, "mpfr_exp", p, (mpfr_rnd_t) rnd); 623 test2 (mpfr_exp2, "mpfr_exp2", p, (mpfr_rnd_t) rnd); 624 test2 (mpfr_exp10, "mpfr_exp10", p, (mpfr_rnd_t) rnd); 625 test2 (mpfr_expm1, "mpfr_expm1", p, (mpfr_rnd_t) rnd); 626 test2 (mpfr_eint, "mpfr_eint", p, (mpfr_rnd_t) rnd); 627 628 test2 (mpfr_sinh, "mpfr_sinh", p, (mpfr_rnd_t) rnd); 629 test2 (mpfr_cosh, "mpfr_cosh", p, (mpfr_rnd_t) rnd); 630 test2 (mpfr_tanh, "mpfr_tanh", p, (mpfr_rnd_t) rnd); 631 test2 (mpfr_asinh, "mpfr_asinh", p, (mpfr_rnd_t) rnd); 632 test2 (mpfr_acosh, "mpfr_acosh", p, (mpfr_rnd_t) rnd); 633 test2 (mpfr_atanh, "mpfr_atanh", p, (mpfr_rnd_t) rnd); 634 test2 (mpfr_sech, "mpfr_sech", p, (mpfr_rnd_t) rnd); 635 test2 (mpfr_csch, "mpfr_csch", p, (mpfr_rnd_t) rnd); 636 test2 (mpfr_coth, "mpfr_coth", p, (mpfr_rnd_t) rnd); 637 638 test2 (mpfr_asin, "mpfr_asin", p, (mpfr_rnd_t) rnd); 639 test2 (mpfr_acos, "mpfr_acos", p, (mpfr_rnd_t) rnd); 640 test2 (mpfr_atan, "mpfr_atan", p, (mpfr_rnd_t) rnd); 641 test2 (mpfr_cos, "mpfr_cos", p, (mpfr_rnd_t) rnd); 642 test2 (mpfr_sin, "mpfr_sin", p, (mpfr_rnd_t) rnd); 643 test2 (mpfr_tan, "mpfr_tan", p, (mpfr_rnd_t) rnd); 644 test2 (mpfr_sec, "mpfr_sec", p, (mpfr_rnd_t) rnd); 645 test2 (mpfr_csc, "mpfr_csc", p, (mpfr_rnd_t) rnd); 646 test2 (mpfr_cot, "mpfr_cot", p, (mpfr_rnd_t) rnd); 647 648 test2 (mpfr_erf, "mpfr_erf", p, (mpfr_rnd_t) rnd); 649 test2 (mpfr_erfc, "mpfr_erfc", p, (mpfr_rnd_t) rnd); 650 test2 (mpfr_j0, "mpfr_j0", p, (mpfr_rnd_t) rnd); 651 test2 (mpfr_j1, "mpfr_j1", p, (mpfr_rnd_t) rnd); 652 test2 (mpfr_y0, "mpfr_y0", p, (mpfr_rnd_t) rnd); 653 test2 (mpfr_y1, "mpfr_y1", p, (mpfr_rnd_t) rnd); 654 test2 (mpfr_zeta, "mpfr_zeta", p, (mpfr_rnd_t) rnd); 655 test2 (mpfr_gamma, "mpfr_gamma", p, (mpfr_rnd_t) rnd); 656 test2 (mpfr_lngamma, "mpfr_lngamma", p, (mpfr_rnd_t) rnd); 657 658 test2 (mpfr_rint, "mpfr_rint", p, (mpfr_rnd_t) rnd); 659 test2 (mpfr_rint_ceil, "mpfr_rint_ceil", p, (mpfr_rnd_t) rnd); 660 test2 (mpfr_rint_floor, "mpfr_rint_floor", p, (mpfr_rnd_t) rnd); 661 test2 (mpfr_rint_round, "mpfr_rint_round", p, (mpfr_rnd_t) rnd); 662 test2 (mpfr_rint_trunc, "mpfr_rint_trunc", p, (mpfr_rnd_t) rnd); 663 test2 (mpfr_frac, "mpfr_frac", p, (mpfr_rnd_t) rnd); 664 665 test3 (mpfr_add, "mpfr_add", p, (mpfr_rnd_t) rnd); 666 test3 (mpfr_sub, "mpfr_sub", p, (mpfr_rnd_t) rnd); 667 test3 (mpfr_mul, "mpfr_mul", p, (mpfr_rnd_t) rnd); 668 test3 (mpfr_div, "mpfr_div", p, (mpfr_rnd_t) rnd); 669 670 test3 (mpfr_agm, "mpfr_agm", p, (mpfr_rnd_t) rnd); 671 test3 (mpfr_min, "mpfr_min", p, (mpfr_rnd_t) rnd); 672 test3 (mpfr_max, "mpfr_max", p, (mpfr_rnd_t) rnd); 673 674 test3 (reldiff_wrapper, "mpfr_reldiff", p, (mpfr_rnd_t) rnd); 675 test3 (mpfr_dim, "mpfr_dim", p, (mpfr_rnd_t) rnd); 676 677 test3 (mpfr_remainder, "mpfr_remainder", p, (mpfr_rnd_t) rnd); 678 test3 (mpfr_pow, "mpfr_pow", p, (mpfr_rnd_t) rnd); 679 pow_int ((mpfr_rnd_t) rnd); 680 test3 (mpfr_atan2, "mpfr_atan2", p, (mpfr_rnd_t) rnd); 681 test3 (mpfr_hypot, "mpfr_hypot", p, (mpfr_rnd_t) rnd); 682 683 test3a (mpfr_sin_cos, "mpfr_sin_cos", p, (mpfr_rnd_t) rnd); 684 685 test4 (mpfr_fma, "mpfr_fma", p, (mpfr_rnd_t) rnd); 686 test4 (mpfr_fms, "mpfr_fms", p, (mpfr_rnd_t) rnd); 687 688 test2 (mpfr_li2, "mpfr_li2", p, (mpfr_rnd_t) rnd); 689 test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt", p, (mpfr_rnd_t) rnd); 690 test3 (mpfr_fmod, "mpfr_fmod", p, (mpfr_rnd_t) rnd); 691 test3a (mpfr_modf, "mpfr_modf", p, (mpfr_rnd_t) rnd); 692 test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh", p, (mpfr_rnd_t) rnd); 693 694 #if MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0) 695 test2 (mpfr_ai, "mpfr_ai", p, (mpfr_rnd_t) rnd); 696 test2 (mpfr_digamma, "mpfr_digamma", p, (mpfr_rnd_t) rnd); 697 #endif 698 } 699 } 700 701 tests_end_mpfr (); 702 return 0; 703 } 704