1 /* tatan -- test file for mpc_atan. 2 3 Copyright (C) 2009, 2012, 2013 INRIA 4 5 This file is part of GNU MPC. 6 7 GNU MPC is free software; you can redistribute it and/or modify it under 8 the terms of the GNU Lesser General Public License as published by the 9 Free Software Foundation; either version 3 of the License, or (at your 10 option) any later version. 11 12 GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY 13 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 more details. 16 17 You should have received a copy of the GNU Lesser General Public License 18 along with this program. If not, see http://www.gnu.org/licenses/ . 19 */ 20 21 #include "mpc-tests.h" 22 23 #if 0 24 /* tests intermediate underflow; WONTFIX */ 25 static int 26 test_underflow (void) 27 { 28 mpc_t z; 29 mpfr_exp_t emin = mpfr_get_emin (); 30 31 mpfr_set_emin (-10); 32 mpc_init2 (z, 21); 33 mpfr_set_si (mpc_realref(z), -1, MPFR_RNDZ); 34 mpfr_set_ui_2exp (mpc_imagref(z), 1, 20, MPFR_RNDZ); 35 mpfr_add_ui (mpc_imagref(z), mpc_imagref(z), 1, MPFR_RNDZ); 36 mpfr_div_2exp (mpc_imagref(z), mpc_imagref(z), 20, MPFR_RNDZ); 37 mpc_atan (z, z, MPC_RNDNN); 38 if (mpfr_cmp_si_2exp (mpc_realref(z), -1066635, 20) != 0 || 39 mpfr_cmp_si_2exp (mpc_imagref(z), 1687619, 22)) 40 { 41 printf ("Error in test_coverage\n"); 42 printf ("expected (-1066635/2^20 1687619/2^22)\n"); 43 printf ("got "); 44 mpc_out_str (stdout, 10, 20, z, MPC_RNDNN); 45 printf ("\n"); 46 exit (1); 47 } 48 mpc_clear (z); 49 mpfr_set_emin (emin); 50 } 51 #endif 52 53 #define MPC_FUNCTION_CALL \ 54 P[0].mpc_inex = mpc_atan (P[1].mpc, P[2].mpc, P[3].mpc_rnd) 55 #define MPC_FUNCTION_CALL_REUSE_OP1 \ 56 P[0].mpc_inex = mpc_atan (P[1].mpc, P[1].mpc, P[3].mpc_rnd) 57 58 #include "data_check.tpl" 59 #include "tgeneric.tpl" 60 61 int 62 main (void) 63 { 64 test_start (); 65 66 data_check_template ("atan.dsc", "atan.dat"); 67 68 tgeneric_template ("atan.dsc", 2, 512, 5, 128); 69 70 test_end (); 71 72 return 0; 73 } 74 75