예제 #1
0
파일: tstckintc.c 프로젝트: Distrotech/mpfr
static void
test2 (void)
{
  mpfr_t x;
  long *a, *b, *c;

  reset_stack ();
  org = (long *) stack;

  a = dummy_set_si (42);
  b = dummy_set_si (17);
  c = dummy_add (a, b);
  c = dummy_compact (c, org);
  (mpfr_custom_init_set) (x, c[0], c[1], p, &c[2]);
  if (c != org || mpfr_cmp_ui (x, 59) != 0)
    {
      printf ("Compact (2) failed! c=%p a=%p\n", (void *) c, (void *) a);
      mpfr_dump (x);
      exit (1);
    }

  a = dummy_set_si (42);
  b = dummy_set_si (-17);
  c = dummy_add (a, b);
  c = dummy_compact (c, org);
  (mpfr_custom_init_set) (x, c[0], c[1], p, &c[2]);
  if (c != org || mpfr_cmp_ui (x, 25) != 0)
    {
      printf ("Compact (6) failed! c=%p a=%p\n", (void *) c, (void *) a);
      mpfr_dump (x);
      exit (1);
    }

  reset_stack ();
}
예제 #2
0
파일: tstckintc.c 프로젝트: SESA/EbbRT-mpfr
static void
test2 (void)
{
  mpfr_t x;
  char *org = stack;
  long *a, *b, *c;

  a = dummy_set_si (42);
  b = dummy_set_si (17);
  c = dummy_add (a, b);
  c = dummy_compact (c, org);
  (mpfr_custom_init_set) (x, c[0], c[1], p, &c[2]);
  if (c != a || mpfr_cmp_ui (x, 59) != 0)
    {
      printf ("Compact (2) failed! c=%p a=%p\n", (void *) c, (void *) a);
      mpfr_dump (x);
      exit (1);
    }
  stack = org;
}