|
Packit |
80c72f |
/* tpow -- test file for mpc_pow.
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
Copyright (C) 2009, 2011 INRIA
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
This file is part of GNU MPC.
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
GNU MPC is free software; you can redistribute it and/or modify it under
|
|
Packit |
80c72f |
the terms of the GNU Lesser General Public License as published by the
|
|
Packit |
80c72f |
Free Software Foundation; either version 3 of the License, or (at your
|
|
Packit |
80c72f |
option) any later version.
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
Packit |
80c72f |
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
Packit |
80c72f |
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
|
Packit |
80c72f |
more details.
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
80c72f |
along with this program. If not, see http://www.gnu.org/licenses/ .
|
|
Packit |
80c72f |
*/
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
#include "mpc-tests.h"
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
static void
|
|
Packit |
80c72f |
reuse_bug (void)
|
|
Packit |
80c72f |
{
|
|
Packit |
80c72f |
/* bug found by the automatic builds on
|
|
Packit |
80c72f |
http://hydra.nixos.org/build/1469029/log/raw */
|
|
Packit |
80c72f |
mpc_t x, y, z;
|
|
Packit |
80c72f |
mp_prec_t prec = 2;
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
for (prec = 2; prec <= 20; prec ++)
|
|
Packit |
80c72f |
{
|
|
Packit |
80c72f |
mpc_init2 (x, prec);
|
|
Packit |
80c72f |
mpc_init2 (y, prec);
|
|
Packit |
80c72f |
mpc_init2 (z, prec);
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
mpfr_set_ui (mpc_realref (x), 0ul, GMP_RNDN);
|
|
Packit |
80c72f |
mpfr_set_ui_2exp (mpc_imagref (x), 3ul, -2, GMP_RNDN);
|
|
Packit |
80c72f |
mpc_set_ui (y, 8ul, MPC_RNDNN);
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
mpc_pow (z, x, y, MPC_RNDNN);
|
|
Packit |
80c72f |
mpc_pow (y, x, y, MPC_RNDNN);
|
|
Packit |
80c72f |
if (mpfr_signbit (mpc_imagref (y)) != mpfr_signbit (mpc_imagref (z)))
|
|
Packit |
80c72f |
{
|
|
Packit |
80c72f |
printf ("Error: regression, reuse_bug reproduced\n");
|
|
Packit |
80c72f |
exit (1);
|
|
Packit |
80c72f |
}
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
mpc_clear (x);
|
|
Packit |
80c72f |
mpc_clear (y);
|
|
Packit |
80c72f |
mpc_clear (z);
|
|
Packit |
80c72f |
}
|
|
Packit |
80c72f |
}
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
int
|
|
Packit |
80c72f |
main (void)
|
|
Packit |
80c72f |
{
|
|
Packit |
80c72f |
DECL_FUNC (C_CC, f, mpc_pow);
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
test_start ();
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
reuse_bug ();
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
data_check (f, "pow.dat");
|
|
Packit |
80c72f |
tgeneric (f, 2, 1024, 7, 10);
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
test_end ();
|
|
Packit |
80c72f |
|
|
Packit |
80c72f |
return 0;
|
|
Packit |
80c72f |
}
|