static void test(void) { int idone, jdone, iidx, jidx; /* loop though all argument value combinations */ for (idone = 0, iidx = 0; i = getargval(iidx, &idone), !idone; iidx++) for (jdone = 0, jidx = 0; j = getargval(jidx, &jdone), !jdone; jidx++) { testmul(); testdiv(); } }
static void check_regular (void) { mpc_t x, y; int rnd_re, rnd_im; mpfr_prec_t prec; testmul (247, -65, -223, 416, 8, 24); testmul (5, -896, 5, -32, 3, 2); testmul (-3, -512, -1, -1, 2, 16); testmul (266013312, 121990769, 110585572, 116491059, 27, 0); testmul (170, 9, 450, 251, 8, 0); testmul (768, 85, 169, 440, 8, 16); testmul (145, 1816, 848, 169, 8, 24); mpc_init2 (x, 1000); mpc_init2 (y, 1000); /* Bug 20081114: mpc_mul_karatsuba returned wrong inexact value for imaginary part */ mpc_set_prec (x, 7); mpc_set_prec (y, 7); mpfr_set_str (mpc_realref (x), "0xB4p+733", 16, MPFR_RNDN); mpfr_set_str (mpc_imagref (x), "0x90p+244", 16, MPFR_RNDN); mpfr_set_str (mpc_realref (y), "0xECp-146", 16, MPFR_RNDN); mpfr_set_str (mpc_imagref (y), "0xACp-471", 16, MPFR_RNDN); cmpmul (x, y, MPC_RNDNN); mpfr_set_str (mpc_realref (x), "0xB4p+733", 16, MPFR_RNDN); mpfr_set_str (mpc_imagref (x), "0x90p+244", 16, MPFR_RNDN); mpfr_set_str (mpc_realref (y), "0xACp-471", 16, MPFR_RNDN); mpfr_set_str (mpc_imagref (y), "-0xECp-146", 16, MPFR_RNDN); cmpmul (x, y, MPC_RNDNN); for (prec = 2; prec < 1000; prec = (mpfr_prec_t) (prec * 1.1 + 1)) { mpc_set_prec (x, prec); mpc_set_prec (y, prec); test_default_random (x, -1024, 1024, 128, 0); test_default_random (y, -1024, 1024, 128, 0); for (rnd_re = 0; rnd_re < 4; rnd_re ++) for (rnd_im = 0; rnd_im < 4; rnd_im ++) cmpmul (x, y, MPC_RND (rnd_re, rnd_im)); } mpc_clear (x); mpc_clear (y); }