xref: /netbsd-src/external/lgpl3/mpc/dist/tests/tatan.c (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /* tatan -- test file for mpc_atan.
2 
3 Copyright (C) 2009, 2012 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, GMP_RNDZ);
34   mpfr_set_ui_2exp (mpc_imagref(z), 1, 20, GMP_RNDZ);
35   mpfr_add_ui (mpc_imagref(z), mpc_imagref(z), 1, GMP_RNDZ);
36   mpfr_div_2exp (mpc_imagref(z), mpc_imagref(z), 20, GMP_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 
54 int
55 main (void)
56 {
57   DECL_FUNC (CC, f, mpc_atan);
58 
59   test_start ();
60 
61   data_check (f, "atan.dat");
62   tgeneric (f, 2, 512, 5, 128);
63 
64   test_end ();
65 
66   return 0;
67 }
68 
69