renamed files

This commit is contained in:
Fredrik Johansson 2012-05-27 19:38:49 +02:00
parent 8eddc357e2
commit 48df1f1886
3 changed files with 0 additions and 202 deletions

View file

@ -1,76 +0,0 @@
#include "mpr.h"
int main()
{
long iter;
flint_rand_t state;
printf("addd_n....");
fflush(stdout);
flint_randinit(state);
for (iter = 0; iter < 1000000; iter++)
{
mp_ptr x, y, z;
mpfr_t t, u, v, w;
long n, xexp, yexp, zexp;
n = 1 + n_randint(state, 40);
x = malloc(n * sizeof(mp_limb_t));
y = malloc(n * sizeof(mp_limb_t));
z = malloc(n * sizeof(mp_limb_t));
mpfr_init2(t, n * FLINT_BITS);
mpfr_init2(u, n * FLINT_BITS);
mpfr_init2(v, n * FLINT_BITS);
mpfr_init2(w, n * FLINT_BITS);
_mpr_randtest(x, state, n);
_mpr_randtest(y, state, n);
_mpr_randtest(z, state, n);
xexp = n_randint(state, 10) - 20;
yexp = n_randint(state, 10) - 20;
_mpr_get_mpfr(t, x, xexp, n, MPFR_RNDN);
_mpr_get_mpfr(u, y, yexp, n, MPFR_RNDN);
if (xexp >= yexp)
zexp = xexp + _mpr_addd_n(z, x, y, xexp - yexp, n);
else
zexp = yexp + _mpr_addd_n(z, y, x, yexp - xexp, n);
_mpr_get_mpfr(w, z, zexp, n, MPFR_RNDN);
mpfr_add(v, t, u, MPFR_RNDD);
if (mpfr_cmp(v, w) != 0)
{
printf("FAIL!\n");
_mpr_printr(x, n);
_mpr_printr(y, n);
_mpr_printr(z, n);
mpfr_printf("\n%.80Rf\n", t);
mpfr_printf("\n%.80Rf\n", u);
mpfr_printf("\n%.80Rf\n", v);
mpfr_printf("\n%.80Rf\n", w);
abort();
}
mpfr_clear(t);
mpfr_clear(u);
mpfr_clear(v);
mpfr_clear(w);
free(x);
free(y);
free(z);
}
printf("PASS\n");
flint_randclear(state);
return EXIT_SUCCESS;
}

View file

@ -1,72 +0,0 @@
#include "mpr.h"
int main()
{
long iter;
flint_rand_t state;
printf("muld_n....");
fflush(stdout);
flint_randinit(state);
for (iter = 0; iter < 10000; iter++)
{
mp_ptr x, y, z;
mpfr_t t, u, v, w;
long n, xexp, yexp, zexp;
n = 1 + n_randint(state, 30);
x = malloc(n * sizeof(mp_limb_t));
y = malloc(n * sizeof(mp_limb_t));
z = malloc(n * sizeof(mp_limb_t));
mpfr_init2(t, n * FLINT_BITS);
mpfr_init2(u, n * FLINT_BITS);
mpfr_init2(v, n * FLINT_BITS);
mpfr_init2(w, n * FLINT_BITS);
_mpr_randtest(x, state, n);
_mpr_randtest(y, state, n);
_mpr_randtest(z, state, n);
xexp = n_randint(state, 10) - 20;
yexp = n_randint(state, 10) - 20;
_mpr_get_mpfr(t, x, xexp, n, MPFR_RNDN);
_mpr_get_mpfr(u, y, yexp, n, MPFR_RNDN);
zexp = xexp + yexp - _mpr_muld_n(z, x, y, n);
_mpr_get_mpfr(w, z, zexp, n, MPFR_RNDN);
mpfr_mul(v, t, u, MPFR_RNDD);
if (mpfr_cmp(v, w) != 0)
{
printf("FAIL!\n");
_mpr_printr(x, n);
_mpr_printr(y, n);
_mpr_printr(z, n);
mpfr_printf("\n%.80Rf\n", t);
mpfr_printf("\n%.80Rf\n", u);
mpfr_printf("\n%.80Rf\n", v);
mpfr_printf("\n%.80Rf\n", w);
abort();
}
mpfr_clear(t);
mpfr_clear(u);
mpfr_clear(v);
mpfr_clear(w);
free(x);
free(y);
free(z);
}
printf("PASS\n");
flint_randclear(state);
return EXIT_SUCCESS;
}

View file

@ -1,54 +0,0 @@
#include "mpr.h"
int main()
{
long iter;
flint_rand_t state;
printf("set_mpfr....");
fflush(stdout);
flint_randinit(state);
_flint_rand_init_gmp(state);
/* test exact roundtrip (todo: test rounding) */
for (iter = 0; iter < 10000; iter++)
{
mp_ptr x;
long exp;
mpfr_t t, u;
long n;
mpfr_rnd_t rnd;
n = 1 + n_randint(state, 10);
x = malloc(n * sizeof(mp_limb_t));
mpfr_init2(t, n * FLINT_BITS);
mpfr_init2(u, n * FLINT_BITS);
mpfr_urandom(t, state->gmp_state, MPFR_RNDN);
mpfr_mul_2exp(t, t, n_randint(state, 20), MPFR_RNDN);
mpfr_div_2exp(t, t, n_randint(state, 20), MPFR_RNDN);
rnd = MPFR_RNDD;
exp = _mpr_set_mpfr(x, t, n, rnd);
_mpr_get_mpfr(u, x, exp, n, rnd);
if (mpfr_cmp(t, u) != 0)
{
printf("FAIL!\n");
mpfr_printf("\n%.200Rf\n", t);
mpfr_printf("\n%.200Rf\n", u);
abort();
}
mpfr_clear(t);
mpfr_clear(u);
free(x);
}
printf("PASS\n");
flint_randclear(state);
_fmpz_cleanup();
return EXIT_SUCCESS;
}