예제 #1
0
파일: tsum.c 프로젝트: BrianGladman/mpfr
static void
get_exact_sum (mpfr_t sum, mpfr_t *tab, int n)
{
  int i;

  mpfr_set_prec (sum, get_prec_max (tab, n));
  mpfr_set_ui (sum, 0, MPFR_RNDN);
  for (i = 0; i < n; i++)
    if (mpfr_add (sum, sum, tab[i], MPFR_RNDN))
      {
        printf ("FIXME: get_exact_sum is buggy.\n");
        exit (1);
      }
}
예제 #2
0
static void algo_exact(mpfr_t somme, mpfr_t *tab, unsigned long n, mp_prec_t f)
{
  unsigned long i;
  mp_prec_t prec_max;
  prec_max = get_prec_max(tab, n, f);
  mpfr_init2 (somme, prec_max);
  mpfr_set_ui (somme, 0, GMP_RNDN);
  for (i = 0; i < n; i++)
    {
      if (mpfr_add(somme, somme, tab[i], GMP_RNDN))
	{
            printf ("FIXME: algo_exact is buggy.\n");
            exit (1);
	}
    }
}