Esempio n. 1
0
/* Test default rounding mode */
static void
check_default_rnd (void)
{
  int r;
  mp_rnd_t t;
  for(r = 0 ; r < GMP_RND_MAX ; r++)
    {
      mpfr_set_default_rounding_mode ((mp_rnd_t) r);
      t = mpfr_get_default_rounding_mode();
      if ((mp_rnd_t) r != t)
	ERROR("ERROR in setting / getting default rounding mode (1)\n");
    }
  mpfr_set_default_rounding_mode ((mp_rnd_t) 4);
  if (mpfr_get_default_rounding_mode() != GMP_RNDD)
    ERROR("ERROR in setting / getting default rounding mode (2)\n");
  mpfr_set_default_rounding_mode ((mp_rnd_t) -1);
  if (mpfr_get_default_rounding_mode() != GMP_RNDD)
    ERROR("ERROR in setting / getting default rounding mode (3)\n");
}
Esempio n. 2
0
/* Test default rounding mode */
static void
check_default_rnd (void)
{
    int r;
    mpfr_rnd_t t;
    for(r = 0 ; r < MPFR_RND_MAX ; r++)
    {
        mpfr_set_default_rounding_mode ((mpfr_rnd_t) r);
        t = (mpfr_get_default_rounding_mode) ();
        if ((mpfr_rnd_t) r != t)
        {
            printf ("%s %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r),
                    mpfr_print_rnd_mode (t));
            ERROR("ERROR in setting / getting default rounding mode (1)");
        }
    }
    mpfr_set_default_rounding_mode ((mpfr_rnd_t) MPFR_RND_MAX);
    if (mpfr_get_default_rounding_mode() != MPFR_RNDA)
        ERROR("ERROR in setting / getting default rounding mode (2)");
    mpfr_set_default_rounding_mode((mpfr_rnd_t) -1);
    if (mpfr_get_default_rounding_mode() != MPFR_RNDA)
        ERROR("ERROR in setting / getting default rounding mode (3)");
}