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