static inline Obj NEW_MPD( mp_prec_t prec ) { Obj f = NEW_DATOBJ(sizeof(__mpd_struct)+2*mpfr_custom_get_size(prec), TYPE_MPD); mpd_ptr p = MPD_OBJ(f); mpfr_custom_init_set(p->re, MPFR_NAN_KIND, 0, prec, REMANTISSA_MPD(p)); mpfr_custom_init_set(p->im, MPFR_NAN_KIND, 0, prec, IMMANTISSA_MPD(p)); return f; }
static long * dummy_add (long *a, long *b) { mpfr_t x, y, z; long *r = dummy_new (); mpfr_custom_init_set (x, 0, 0, p, &r[2]); (mpfr_custom_init_set) (y, a[0], a[1], p, &a[2]); mpfr_custom_init_set (z, b[0], b[1], p, &b[2]); mpfr_add (x, y, z, MPFR_RNDN); r[0] = (mpfr_custom_get_kind) (x); r[1] = (mpfr_custom_get_exp) (x); return r; }
/* Alloc a new mpfr_t on the main stack */ static mpfr_ptr new_mpfr (mpfr_prec_t p) { mpfr_ptr x = (mpfr_ptr) new_st (sizeof (mpfr_t)); void *mantissa = new_st (mpfr_custom_get_size (p)); mpfr_custom_init (mantissa, p); mpfr_custom_init_set (x, 0, 0, p, mantissa); return x; }