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