Example #1
0
void
testmain (int argc, char *argv[])
{
  check_small ();
  check_composites ();
  check_primes ();
}
Example #2
0
int
main (int argc, char *argv[])
{
#ifdef WITH_FPU_CONTROL
  fpu_control_t cw;

  /* cw=895 (0x037f): round to double extended precision
     cw=639 (0x027f): round to double precision
     cw=127 (0x007f): round to single precision */
  if (argc > 1)
    {
      cw = strtol(argv[1], NULL, 0);
      printf ("FPU control word: 0x%x\n", (unsigned int) cw);
      _FPU_SETCW (cw);
    }
#endif

  tests_start_mpfr ();

  check_special ();

  check_large ();

  check_small ();

  tests_end_mpfr ();

  return 0;
}
Example #3
0
int
main (int argc, char *argv[])
{
  int b;
  mpfr_t x;
  mpfr_rnd_t r;
  char s[MAX_DIGITS + 2];
  mpfr_exp_t e, f;
  size_t m;
  mpfr_prec_t p;
  int i;

  tests_start_mpfr ();

  check_small ();

  check_special (2, 2);
  for (i = 0; i < ITER; i++)
    {
      p = 2 + (randlimb () % (MAX_DIGITS - 1));
      b = 2 + (randlimb () % 35);
      check_special (b, p);
    }

  mpfr_init2 (x, MAX_DIGITS);
  for (i = 0; i < ITER; i++)
    {
      m = 2 + (randlimb () % (MAX_DIGITS - 1));
      mpfr_urandomb (x, RANDS);
      e = (mpfr_exp_t) (randlimb () % 21) - 10;
      if (!MPFR_IS_ZERO(x))
        mpfr_set_exp (x, (e == -10) ? mpfr_get_emin () :
                      ((e == 10) ? mpfr_get_emax () : e));
      b = 2 + (randlimb () % 35);
      r = RND_RAND ();
      mpfr_get_str (s, &f, b, m, x, r);
    }
  mpfr_clear (x);

  check_large ();
  check3 ("4.059650008e-83", MPFR_RNDN, "40597");
  check3 ("-6.606499965302424244461355e233", MPFR_RNDN, "-66065");
  check3 ("-7.4", MPFR_RNDN, "-74000");
  check3 ("0.997", MPFR_RNDN, "99700");
  check3 ("-4.53063926135729747564e-308", MPFR_RNDN, "-45306");
  check3 ("2.14478198760196000000e+16", MPFR_RNDN, "21448");
  check3 ("7.02293374921793516813e-84", MPFR_RNDN, "70229");

  check3 ("-6.7274500420134077e-87", MPFR_RNDN, "-67275");
  check3 ("-6.7274500420134077e-87", MPFR_RNDZ, "-67274");
  check3 ("-6.7274500420134077e-87", MPFR_RNDU, "-67274");
  check3 ("-6.7274500420134077e-87", MPFR_RNDD, "-67275");
  check3 ("-6.7274500420134077e-87", MPFR_RNDA, "-67275");

  check3 ("6.7274500420134077e-87", MPFR_RNDN, "67275");
  check3 ("6.7274500420134077e-87", MPFR_RNDZ, "67274");
  check3 ("6.7274500420134077e-87", MPFR_RNDU, "67275");
  check3 ("6.7274500420134077e-87", MPFR_RNDD, "67274");
  check3 ("6.7274500420134077e-87", MPFR_RNDA, "67275");

  check_bug_base2k ();
  check_reduced_exprange ();

  tests_end_mpfr ();
  return 0;
}