1 /* tprec -- Test file for mpc_set_prec, mpc_get_prec and mpc_get_prec2.
3 Copyright (C) 2009, 2011 INRIA
5 This file is part of GNU MPC.
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.
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
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/ .
22 #include "mpc-tests.h"
28 mpfr_prec_t prec, pr, pi;
32 for (prec = 2; prec <= 1000; prec++)
34 /* check set_prec/get_prec */
35 mpfr_set_prec (mpc_realref (z), prec);
36 mpfr_set_prec (mpc_imagref (z), prec + 1);
37 if (mpc_get_prec (z) != 0)
39 printf ("Error in mpc_get_prec for prec (re) = %lu, "
40 "prec (im) = %lu\n", (unsigned long int) prec,
41 (unsigned long int) prec + 1ul);
46 mpc_get_prec2 (&pr, &pi, z);
47 if (pr != prec || pi != prec + 1)
49 printf ("Error in mpc_get_prec2 for prec (re) = %lu, "
50 "prec (im) = %lu\n", (unsigned long int) prec,
51 (unsigned long int) prec + 1ul);
56 mpc_set_prec (z, prec);
57 if (mpc_get_prec (z) != prec)
59 printf ("Error in mpc_get_prec for prec = %lu\n",
60 (unsigned long int) prec);